Modifying and Extending Project Template Mappings
To add a T4 file to a project, you modify the associated XML file by adding <Action> nodes in the <Actions> parent node. For example, to add a message class to another project type, you add a Generate <Action> and an Add <Action> to the <Actions> section of the XML file for your chosen project type. In the Template attribute of the Generate <Action> node, you must indicate the T4 file to be used. In the <Input> node, specify the parameters that are passed to the T4 file for use in code generation.
To remove a T4 file from a project, you must modify the associated XML file by removing the Generate <Action> a Add <Action> nodes for the T4 file. The following example shows a section of the MessagesCommonEntities.xml file.
<Action Name="GenerateMessageClass" Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library" Template="Text\Messages\BaseRequestClassForStateWF.cs.t4">
<Input Name="TargetNamespace" ActionOutput="GetEntitiesNamespace.ReturnValue" />
<Input Name="ProjectName" ActionOutput="GetServiceNameAction.PropertyValue" />
<Input Name="ClassName" RecipeArgument="className" />
<Output Name="Content" />
</Action>
<Action Name="AddMessageClass" Type="Microsoft.ConnectedIndustry.ProcessExecution.AddIns.VSExtensions.Actions.CustomAddItemFromStringAction, Microsoft.ConnectedIndustry.ProcessExecution.SoftwareFactory" Open="false">
<Input Name="Content" ActionOutput="GenerateMessageClass.Content" />
<Input Name="TargetFileName" RecipeArgument="targetFile" />
<Input Name="InsertIntoClassDesigner" RecipeArgument="TrueString" />
<Input Name="ClassDesignerClassName" RecipeArgument="className" />
<Input Name="Project" RecipeArgument="currentProject" />
</Action>
The following table lists the XML files that you can modify to change the mapping of project types to T4 template files.
|
Project Type |
XML File |
|---|---|
|
BLCategory |
DCS_SF.xml |
|
BLSpecific |
BLSpecificBLCategoriesCommonEntities.xml BLSpecificBLCategoriesOneWayEntities.xml BLSpecificBLCategoriesSequenceWFStub.xml BLSpecificBLCategoriesStateWFStub.xml BLSpecificEvents.xml BLSpecificSequenceWFFromDll.xml BLSpecificStateWFFromDll.xml DCS_SF.xml |
|
Messages |
MessagesCommonConfig.xml MessagesCommonEntities.xml |
|
Stub |
StubBLCategoriesCommonConfig.xml StubSequenceWFFromDll.xml StubStateWFFromDll.xml |
|
Test |
DCS_SF.xml |
|
WFTask |
WFTaskWF.xml |