I´m using almost the same format for the files I generate, for example:
** To generate a simple Entity class **
<!-- Generates code by rendering the T4 template using the received arguments --> <Action Name="GenerateDAC" Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library" Template="Text\Entity.cs.t4"> <Input Name="Table" ActionOutput="GetTableSchema.TableSchema" /> <Input Name="Indexes" ActionOutput="GetTableSchema.Indexes" /> <Input Name="ListName" ActionOutput="GetTableSchema.ListName"/> <Input Name="ClassName" RecipeArgument="ClassName" /> <Input Name="TargetNamespace" RecipeArgument="TargetNamespace" /> <Input Name="EntityClassName" RecipeArgument="EntityFullName" /> <Input Name="ConnectionName" RecipeArgument="ConnectionName" /> <Output Name="Content" /> </Action> <!-- Adds the generated output from the T4 template to the project as an item --> <Action Name="AddClass" Type="Microsoft.Practices.RecipeFramework.Library.Actions.AddItemFromStringAction, Microsoft.Practices.RecipeFramework.Library" Open="true"> <Input Name="Content" ActionOutput="GenerateDAC.Content" /> <Input Name="TargetFileName" RecipeArgument="TargetFile" /> <Input Name="Project" RecipeArgument="CurrentProject" /> </Action>
** To generate an XML ****
Action Name="GenerateDAC" Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library" Template="Text\Entity.cs.t4"> <Input Name="Table" ActionOutput="GetTableSchema.TableSchema" /> <Input Name="Indexes" ActionOutput="GetTableSchema.Indexes" /> <Input Name="ListName" ActionOutput="GetTableSchema.ListName"/> <Input Name="ClassName" RecipeArgument="ClassName" /> <Input Name="TargetNamespace" RecipeArgument="TargetNamespace" /> <Input Name="EntityClassName" RecipeArgument="EntityFullName" /> <Input Name="ConnectionName" RecipeArgument="ConnectionName" /> <Output Name="Content" /> </Action> <!-- Adds the generated output from the T4 template to the project as an item --> <Action Name="AddClass" Type="Microsoft.Practices.RecipeFramework.Library.Actions.AddItemFromStringAction, Microsoft.Practices.RecipeFramework.Library" Open="true"> <Input Name="Content" ActionOutput="GenerateDAC.Content" /> <Input Name="TargetFileName" RecipeArgument="TargetFile" /> <Input Name="Project" RecipeArgument="CurrentProject" /> </Action>
I am able to generate all the files needed. In the end, I generate 8 different files but they are all created in the same root/directory. I´m aiming on finding a way to create them in different folders. For example, the Entities in the Entities folder (which is already created on the creation of the project) The XML in the XML folder, and so on.
|