Visual Studio Development Bookmark and Share   
 index > Visual Studio Guidance Automation Toolkit > Workaround for the UnfoldTemplateAction and parameter replacements
 

Workaround for the UnfoldTemplateAction and parameter replacements

Iposted a workaround for the issue that has the UnfoldTemplateAction which are not replacing the gax parameters into the templates.

You can find it here: http://weblogs.asp.net/jescrich/archive/2007/10/05/dealing-with-the-unfoldtemplateaction-and-parameter-replacement.aspx

hth

jose.

Jose Escrich  Friday, October 05, 2007 7:23 PM
Hi Jose,

Could you please post whats required for each parameter?

I set it up with:

<Action Name="CreateProject" Type="MyPackage.Actions.ExtendedUnfoldTemplateAction, MyPackage">
<Input Name="ItemName" RecipeArgument="ProjectName"/>
<Input Name="TemplatePath" RecipeArgument="TemplatePath"/>
<Input Name="Root" RecipeArgument="SolutionPath"/>
<Input Name="DestinationFolder" RecipeArgument="ProjectPath"/>
<Output Name="NewItem"/>
</Action >


Where:
ProjectName is a string with the name I want for the project.
TemplatePath is the full path to the template I want to use.
Root is the full path to the root folder for my current solution.
ProjectPath is the path where I want the project created.

I debug through the action, and I dont get an error from the unfoldTemplateAction.Execute(); call, however the unfoldTemplateAction.NewItem property doesnt get set, and the project isnt created. Am I passing the wrong information for any of them? Do I need to be setting any other information?
Ben Scott - Aust  Thursday, October 11, 2007 1:57 AM
Another question, what benefit do we get from using the unfoldTemplateAction?

I replaced:

unfoldTemplateAction.Template = templatePath;
unfoldTemplateAction.ItemName = itemName;
unfoldTemplateAction.Root = root;
unfoldTemplateAction.DestinationFolder = destinationFolder;
unfoldTemplateAction.Execute();

With:

DTE dte = base.GetService<DTE>(true);
this.newItem = dte.Solution.AddFromTemplate(TemplatePath, DestinationFolder, ItemName, false);

And it worked for me. Is there any reason not to just do it that way?
Ben Scott - Aust  Thursday, October 11, 2007 2:50 AM

Hi Ben,

The UnfoldTemplateAction resolve how to add the template to the root item due to there are different ways to add a template if the root is a Solution, a SolutionFolder or just a Project. So with that approach you should use different actions for each root type.

The issue with the newItem seems a bug in the UnfoldTemplateAction builtin action. I'll look into it and get back to you.

jose.

Jose Escrich  Thursday, October 11, 2007 2:04 PM
Thanks Jose.

That makes sense, and for my needs writing my own actions for each scenario gives me the control I need.

Hmm, I was passing in a path as a root, sounds like I should have been passing the object I wanted as the root? That may be what was causing the newItem issue.

Thanks for all your help Jose, its really appreciated!

- Ben
Ben Scott - Aust  Thursday, October 11, 2007 11:59 PM

Jose,

Thanks a lot for this. It worked like a charm.

-Jeff

Jeff Paine  Wednesday, October 17, 2007 3:13 PM

You can use google to search for other answers

Custom Search

More Threads

• Some doubts in creating GAT package
• Pass an argument to value provider
• Cannot install DataAccessGuidancePackageSetup.msi
• BizTalk Project Type
• Get Project Reference Sample Code
• Add View context menu not displayed for some projects
• Database Project template
• Guidance Package Uninstallation Damaging GAT
• Question about Arguments
• Reference Issue