Search code examples
visual-studio-2012biztalkbiztalk-2013

Biztalk template with non-static namespace - Visual Studio


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.

enter image description here

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.


Solution

  • 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.