Biztalk template with non-static namespace - Visual Studio - visual-studio-2012

I've exported an orchestration template using Visual Studio 2012, based on one I previously constructed. It generates a .zip with the following .vstemplate file:
<VSTemplate Type="Item" Version="2.0.0"
xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
<TemplateData>
<Name>TESTOrchestration</Name>
<Description>Custon Orchestration</Description>
<Icon>Icon.ico</Icon>
<ProjectType>Biztalk</ProjectType>
<DefaultName>TESTOrchestration.odx</DefaultName>
</TemplateData>
<TemplateContent>
<ProjectItem TargetFileName="$fileinputname$.odx" ReplaceParameters="true">Orchestration.odx</ProjectItem>
</TemplateContent>
Using this item template in VS2012 creates an orchestration with the properties shown in the fig. below.
Notice the namespace is that of the original project from which the template was exported.
I want to set the default namespace of this item to include the project name (or even better the path leading to this item within the project). After searching I've yet to find a working example of how to accomplish this in a BizTalk item, namely an .odx.
Thank you for taking the time to read my question. I really hope you will be able to help me with this.

After searching and tinkering around I found out how to accomplish this.
When you export a template from Visual Studio two files are created, a .vstemplate and a template of the exported item, in this case a .odx. In order to alter the namespace, and other attributes, you need to edit this second file and add the information you want.
It is also possible to pass dynamic values by using template parameters in the form of $parameter$, which are documented in Microsoft's library.
So, for example, if you wanted to modify the namespace to include the project name, you would have to edit the exported .odx file and add the parameter $safeprojectname$ or $rootnamespace$ to dynamically set the namespace uppon creation of a new item based on the template.

Related

Class name is invalid or already implemented in the selected source file

I have a solution in VS2017 including 7 different C# or C++ projects. I add a new project to generate a dynamic link library (.dll) and then trying to create a new class in the newly created project using add option. But I get the following message:
"Class 'sampleProvider' is either invalid or already implemented in the selected source file."
Previously, I have defined a class with the same name in a project of the current solution, but then I have removed and deleted the project and all relevant references.
I checked the windows registry. There is no any entry, key or value in the windows registry with the same name. Also there is no any file in the windows file system with the same name.
But in my solution directory in a hidden folder named ".vs" in '...\.vs\MySolutionName\v14' there are two files named '.suo' and 'Browse.VC.db' which include few references to old class name. I know that '.suo' is a file includes 'Visual Studio Solution User Options' and 'Browse.VC.db' is IDE Database File. I am not pretty sure what happens if I delete these two files or all mentioned references from these two. Dose it possible to define my own class with my preferred name, afterwards?
Any help is appreciated in advance.

In Visual Studio, how do I override a project property value which is not inherited without editing the vcxproj file

In Visual Studio 2013/VC++ for a statically linked executable, how do I override a property setting, when it is in bold( not inherited) by using a property sheet? I cannot edit the vcxproj file as it is auto generated and direct edits are lost when it is generated.
Details:
I have a Visual studio solution that contains two projects:
Dependency.vcxproj --> Generates Dependency.lib which is a static library.
MyProg.vcxproj --> Links to Dependency.lib and generates MyProg.exe
Of these, Dependency.vcxproj is auto generated and I do not have control over its generation( It is generated from a build script every time I run it). I see that It has Optimization set to O2 and also has Debug Information Format set to none. ( Both of these are in bold - so I assume they have been explicitly turned off). However, to allow for debug, I want to override these properties and set Optimization Disabled and Debug Information Format to /Zi when I am building it as part of my solution.
I tried overriding it using a .props file for the project, but the values are not overridden - I read somewhere that a property needs to inherit for a props sheet to override.
Is there any way to override such an already modified property without editing the vcxproj file itself?
You need to make sure you lib project is actually using your .props file. Means, it has to be included in the project. If you want to override already defined property with .props, this .props needs to be included after the property is set to override it. Basically .props work similar to text inclusion.
Another option could be to use .user file to override the properties (.user may be already included into generated .vcxproj, with condition "if exists"). But anyways you need to find a way to include your file re-defining the linker properties into the .vcxproj file.
Normally, you use "debug" vs "release" configurations to allow/disallow debugging. Maybe you just need to select "debug" configuration for your solution (this one can be found in the toolbar, a combo box in Visual studio) and then build?
If this is not the case, I would say the easiest way out may be modifying the script you use to generate the project to generate the project you want.

Adding a custom t4 template to DDL Generation Template dropdownlist

I know I can add the template in the folder
C:\Program Files (x86)\Microsoft Visual Studio
11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\DBGen
to make it visible in the DDL Generation Template dropdownlist, but then I need to distribute the template to my team members so they can add the template to the same folder.
I was hoping that I could achieve the same result by adding the template to the VS 2012 solution somehow and make it visible in the same dropdownlist
Do you know a way to achieve this?
I'm using VS 2012 and to generate the database I use Model First approach
I played around with this tonight and found it is possible, but it's kind of a hack. You'll have to edit your edmx file by hand, and make sure it is version controlled because you have to edit the designer section of the edmx file (auto-generated). First thing is to copy the t4 template to the root of your project (might actually have to be in the same folder as the edmx, not sure). Then add the t4 template to your project. Now remove the custom tool entry (in properties) so it doesn't try and auto gen the t4 template. finally add the designer property below in the correct location in the edmx file (i included context to find the right place):
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<edmx:Options>
<DesignerInfoPropertySet>
<DesignerProperty Name="DDLGenerationTemplate" Value="SSDLToSQLite3.tt" />
I ended up making a custom template to generate datetime2 fields. Although I could not get the template to show in the drop down in the properties box, I was able to add the template to the same folder as my .edmx, include it in the solution, then type the file name of the template directly into the designer's property field replacing the default. The value appears to be retained after generating databases and entities, I didn't need to directly edit the edmx XML, and my custom template is now source controlled right next to where it is used.

How can I add Classes from a referenced C# Assembly to a ClassDiagram in my current project

I have a referenced assembly that has a (devart) Linq Datacontext in it. We use this same assembly in a bunch of other projects and I don't want to add the source code to my current solution.
How can I add some of the classes in it to a ClassDiagram in my current project?
EDIT in Response to Comments/Answers
I don't have access to the original source code of the external project.
What I mean't was when I said "I don't want to add the source code to my current solution." was I don't want to build up a bunch of partials in my current solution either.
Include a reference to the library in your project.
Go to the object browser (View->Object Browser) and search for your class.
Drag and drop it from the object browser onto the design surface.
I tried it with System.Random and it pulls all the properties and methods.

where to add the c sharp code in this example to make changes in sharepoint programmatically?

i am trying to programmatically do some changes in sharepoint as per the link below
in the link below there is a the second cod snippet is a C sharp code. where do i put this code ? or how can i use this code in sharepoint is not mentioned .. can anyone please tell me ?
http://weblogs.asp.net/wesleybakker/archive/2009/03/05/select-multiple-list-items-in-sharepoint-feature.aspx
I haven't tried any of the code out in the post you linked to, but it looks like the C# code just needs to be compiled into an assembly and deployed to the SharePoint server.
The <CustomAction> element in the feature XML below the C# code references this assembly via the ControlAssembly attribute and the compiled class is referenced by the ControlClass attribute.
If you're adapting the code in the post and creating your own project, ensure that your assembly and class names are correctly referenced in the feature XML file (through the ControlAssembly and ControlClass attributes).
Alternatively you can download the author's SharePoint Solution Pack which contains this feature and others.
you should create a new program to call the method

Resources