Visual Studio Development Bookmark and Share   
 index > Visual Studio Guidance Automation Toolkit > How to execute actions after solution template was unfolded
 

How to execute actions after solution template was unfolded

Hey guys,

in this article
http://guidanceautomation.net/wysiwiki/default.aspx?topic=Understanding%20Template%20and%20Recipe%20Associations
MS writes that the steps are executed in the following order when unfolding
a solution template with a referenced recipe:
-Run wizard pages to collect data
-Unfold the template
-Execute actions in recipe

I tried this and from what I can tell the actions defined in the recipe get
executed before the solution was unfolded (and therefore are not able to
modify the solution items). Here is what my definitions look like:

MySolution.vstemplate
...
<WizardExtension>
<Assembly>Microsoft.Practices.RecipeFramework.VisualStudio,
Version=1.0.51206.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a</Assembly>
<FullClassName>Microsoft.Practices.RecipeFramework.VisualStudio.Templates.UnfoldTemplate</FullClassName>
</WizardExtension>
<WizardData>
<Template xmlns="
http://schemas.microsoft.com/pag/gax-template"
SchemaVersion="1.0" Recipe="CreateSolution">
<References>
</References>
</Template>
</WizardData>

MyPackage.xml
...
<Recipe Name="CreateSolution">
<Caption>Unfold a new solution.</Caption>
<Arguments>
<Argument Name="FeatureModelConfigFile" Type="System.String">
<Converter Type="CGP.Converters.FileExistsConverter,
ConfigurableGuidancePackage" />
</Argument>
</Arguments>
<GatheringServiceData>
<Wizard xmlns="
http://schemas.microsoft.com/pag/gax-wizards"
SchemaVersion="1.0">
<Pages>
<Page Type="CGP.CustomWizardPages.GatherSolutionDataWizard, MyPackage"
Width="500" Height="400">
<Title>Feature Model Configuration</Title>
</Page>
</Pages>
</Wizard>
</GatheringServiceData>
<Actions>
<Action Name="HelloWorld" Type="CGP.Actions.HelloWorldAction,
MyPackage">
<Input Name="FeatureModelConfigFile"
RecipeArgument="FeatureModelConfigFile" />
</Action>
</Actions>
</Recipe>

When I unfold the template I set a breakpoint in the HelloWorldAction to
examine the EnvDTE.Solution object. This object has no filename, is dirty,
is not saved, etc. So to me it clearly looks like the HelloWorldAction is
executed before the solution template was unfolded, in contrast to what MS
says in above article. But I actually hope I'm just doing something wrong
;-)

Can anybody tell me more?

Thanks, Christoph
Christoph Wienands  Monday, March 13, 2006 12:13 AM
Effectively, solution properties are not consistent during the unfold process, and what you're seeing is a well-known bug in VS.

If you need to access the solution path, instead of using the Solution.FileName property, use Solution.Properties.Item("Path").Value


kzu  Monday, March 13, 2006 3:18 PM
Effectively, solution properties are not consistent during the unfold process, and what you're seeing is a well-known bug in VS.

If you need to access the solution path, instead of using the Solution.FileName property, use Solution.Properties.Item("Path").Value


kzu  Monday, March 13, 2006 3:18 PM

Hey kzu,

thanks for the update. Now, my question is:

Can I execute other actions that e.g. unfold other project templatesat that time?

I have a solution that I want to fill with 0, 1 or more projects depending on some external variables. From my understanding I can't include these projects in the solution template because then allthe projects will always get unfolded but I don't want that.

Therefore my approach with first creating an empty solution and then programmatically unfold other projects depending on the input. Will the project properties then be consistent when I unfold those?

I'll give it shot soon but if you have an answer for me beforehand, that might help me a lot.

Thanks, Christoph

Christoph Wienands  Tuesday, March 14, 2006 12:01 AM

You can use google to search for other answers

Custom Search

More Threads

• no menu entry in VSS 08 for guidance automation packages
• How to get RecipeArgument Value
• Enable GAT for existing projects
• Re: How to develop a design center for my website.
• Tom, I see what has been keeping you busy post the E.L.
• Installation error
• Create New Project Hangs
• Is there any way to run an action when a project with my guidance package enabled is opened?
• Recipe framework error
• HoL Registration failed