Hello, I have template project that use parameters of the type $Namespace$, for example.
it is possible to pass parameters when the UnfoldTemplateAction is used.
Thanks |
| Leandro Tuttini Friday, August 03, 2007 3:48 PM |
Here you have the reference to the VS Template parameters: http://msdn2.microsoft.com/en-us/library/eehb4faa(VS.80).aspx
|
| Adrian Alonso Monday, August 06, 2007 2:48 PM |
Hi, there are two kinds of templates: The VS Template and the T4 templates. You can pass paremeters to both of them. What are your trying to do? Passing parameters to a VS template when you are unfolding a template? or passing parameters to a T4 when you are unfolding a T4 template executing the UnfoldTemplateAction?
If your are in the second scenario you can pass parameters to the template as action inputs. For example:
<Action Name="GenerateProvider" Type="TextTemplateAction" Template="Provider.t4"> <Input Name="ProviderName" RecipeArgument="ProviderName" /> <Output Name="Content" /> </Action>
|
| Adrian Alonso Friday, August 03, 2007 3:59 PM |
Adrian, thousand thanks, these giving one helps me impressive.
I comment to you.
This it is of the type VS Template, for that reason I am using the UnfoldTemplateAction.
With this actionload the.vstemplate
But the parameter of type of $NombreParametro$, are not replaced.
Even though that the tag argument within recipe is including.
Excuse if my English is not good, I speak Spanish |
| Leandro Tuttini Friday, August 03, 2007 4:16 PM |
I'm sure if I'm following you. If you are using a VS template you shouldn't need an action for unfolding it. The template should be registered when the Guidance Package is registered and you should be able to create the template via the Menus "New Project", "New Item". Anyway if you are using VS Templates you should be able to replace the parameters if the recipe contains arguments with the same name.
For example: If you have an argument called "Namespace" of type string in your recipe, then you should be able to use it in your VS Template as $Namespace$.
Are you executing a recipe as part of the template unfolding?
|
| Adrian Alonso Friday, August 03, 2007 4:27 PM |
I am not exposing template directly.
I am calling to template from recipe.
The recipe realiza ejecuta varias acciones previamente, como ser crear carpetas en la solucion, y luego carga en estas los template de proyecto.
Es por esto, que el template es llamado desde un recipe por medio del UnfoldTemplateAction.
I am using the following action inside the recipe:
< Action Name="UnfoldWCFBusinessEntityProjectTemplate" Type="UnfoldTemplateAction" Path="">
< Input Name="ItemName" ActionOutput="GetWCFProjectsName.BusinessEntityProjectName" />
< Input Name="Root" ActionOutput="CreateBusinessLogicFolder.NewFolder" />
< Input Name="Template" ActionOutput="GetWCFTemplatePathBusinessEntity.TemplateFilePath" />
< Input Name="DestinationFolder" ActionOutput="CreateFolderStructureBusinessEntity.FullPath" />
< Output Name="NewItem" />
</ Action>
This is the alias of the action:
< TypeAlias Name="UnfoldTemplateAction" Type="Microsoft.Practices.RecipeFramework.Extensions.Actions.Templates.UnfoldTemplateAction, Microsoft.Practices.RecipeFramework.Extensions" />
But this not suport parameters.
In others post, I saw that adding the key of the parameter in the global dictionary podia to take it.
Thanks |
| Leandro Tuttini Friday, August 03, 2007 5:31 PM |
Could you post the template code please?
btw: are you defining the path attribute in the action "UnfoldWCFBusinessEntityProjectTemplate"?
Thanks, -Adrian
|
| Adrian Alonso Friday, August 03, 2007 5:49 PM |
Exactly, in input to parameter “Template� I specify the complete physical route where is .vstemplate, for that reason is another action the one in charge to solve it.
Recipe is a little great, I am going to see shorten it a little to send it in the message.
The action UnfoldTemplate works well, single that does not take the parameters.
In the Argument of recipe, put the following:
<Argument Name="ProjectName">
<ValueProvider Type="Evaluator" Expression="ProjectExample" />
</Argument>
But it does not take the value from the argument like parameter of template.
In this case simply I am using a fixed value in the parameter, “ProjectExample� to notice that it is replaced. |
| Leandro Tuttini Friday, August 03, 2007 6:38 PM |
The thing is that the UnfoldTemplateAction is for unfolding *T4* templates. You are trying to unfold a .vstemplate using this action. The syntax $ProjectName$ won't work. Instead you should be using the T4 syntax (<#= ProjectName #>).
Take a look at the T4 section in the Guidance Automation Toolkit documentation for an overview of the T4 syntax.
|
| Adrian Alonso Friday, August 03, 2007 6:48 PM |
Looking for a little in the network, after the commentary about the parameters in T4 templates.
I found the following link:
This it makes use of the UnfoldTemplateAction, of the same form in which I do it.
In the recipe CreateSimpleSolution, use the following:
<Action Name="UnfoldDataLayerProjectTemplate" Type="UnfoldTemplateAction" Template="Solutions\Projects\DataLayer\DataLayer.vstemplate"> <Input Name="Root" RecipeArgument="SolutionArgument" /> <Input Name="DestinationFolder" RecipeArgument="DataLayerProjectFolder" /> <Input Name="ItemName" RecipeArgument="DataLayerProjectName" /> <Output Name="NewItem" /> </Action>
And the DataLayer.vstemplate use parameter, because DataLayer.csproj, define
<RootNamespace>MyCompany.$safeprojectname$</RootNamespace> <AssemblyName>$safeprojectname$</AssemblyName>
But I do not find where it specifies the parameter in recipe.
but I understand bad seems to be that this having he himself problem with the parameters. |
| Leandro Tuttini Friday, August 03, 2007 7:16 PM |
Here you have the reference to the VS Template parameters: http://msdn2.microsoft.com/en-us/library/eehb4faa(VS.80).aspx
|
| Adrian Alonso Monday, August 06, 2007 2:48 PM |