Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Dealing with the UnfoldTemplateAction and parameter replacement.

There are a well known issue with the UnfoldTemplateAction which is provided in the GAX Library. Basically this action able you to unfold .vstemplate files by hand but it has a ugly issue in where you can't do any parameter replacements than the default ones.

In fact is not a bug into the action so the issue resides in that is using the AddFromTemplate method from the DTE automation model and there's no way to pass any replacement dictionary using that method directly.

So I wrote an action in order to have a workaround, basically what it does is create a copy of the vstemplate and its elements, perform all the replacements, then unfold the template through the UnfoldTemplateAction.

You can download the source from here.

Hope that helps!

3 Comments

  • Hello,

    I'm trying to implement the action class that you created. Can you give a sample recipe how this would consume the action class you created? I have created a recipe but I only implemented putting values to the TemplatePath (path to the vstemplate) and itemName(test name for the project) and I'm getting some object reference errors. Thanks.

  • http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2234458&SiteID=1 there you'll find a description of each parameter.

  • Fantastic work. Unfortunately I found it after hammering my head against the wall for far too long! One slight improvement I made was to add the following override;

    public override void Configure(System.Collections.Specialized.StringDictionary attributes)
    {
    this.TemplatePath = attributes["Template"];
    base.Configure(attributes);
    }

    This prevented the line below from causing a runtime error;

    templatePath = new FileInfo(Path.Combine(configurationService.BasePath + @"\Templates\", templatePath)).FullName;

    Thanks again!

Comments have been disabled for this content.