|
Hey.
I can't find any way to fill an argument in a recipe (from a wizard for exemple) and then reuse it in another.
Here is what I do:
In the first recipe which creates my solution: <Argument Name="LatestVersionPath" Required="true"> <Converter Type="MyNamespace.Converters.FolderExistsConverter, MyNamespace"/> <ValueProvider Type="Microsoft.Practices.RecipeFramework.Extensions.ValueProviders.VisualStudio.SolutionPathProvider, Microsoft.Practices.RecipeFramework.Extensions" /> </Argument> And in the wizard <Field ValueName="LatestVersionPath" Label="Latest Version Path"> <Editor Type="System.Windows.Forms.Design.FolderNameEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> </Field>
With this argument I can do the staff I want to create a project and add it the wanted reference.
Later, when I run a recipe with a right click on a file with a specific extension, I need this argument again, and I don't want to launch a wizard only to retrieve it (and the user already filled it, so he doesn't want to do it again).
But I don't know how to do this. I tried to insert this argument in my second recipe with: <!-- Include argument from CreateOPApplication recipe --> <xi:include href="CreateOPApplication.xml" xpointer="xmlns(gax=http://schemas.microsoft.com/pag/gax-core) xpointer(//gax:Argument[@Name='LatestVersionPath'])" />
but obviously it gets the default argument value and not the one filled by the user.
Is it possible to do what I want? Is there any file (like a resources file) for a solution (not a project) where I can store my arguments to reuse it later?
Thank you for any advice.
-- Matthias.
| | malrok Monday, December 17, 2007 9:30 AM | You can programatically access recipe arguments with the following code without having to show UI or anything like that:
IDictionaryService dictionary = (IDictionaryService)GetService(typeof(IDictionaryService)); object value = dictionary.GetValue("Framework"); String frameworkLocation = (String)value;
HTH, -Victor.
| | vga Monday, December 17, 2007 3:45 PM | You will need to persist the given values for any recipe arguments you're interested in by yourself as there is no built-in mechanism for this in GAX.
There are APIs in VS to persist values to the solution (.sln), solution user options (.suo) and project files (.xxproj) files, each one has it's own PROs and CONs and choosing one will depend on a few factors like if you want to version or not the values, if you want them to be per-user o per-solution, etc, etc. You could of course persist these values to your own custom file too.
If you want to learn more on these APIs I would suggest you get to the MSDN docs and post any doubts to the VS extensibility forum which would be more appropiate because of the topic.
HTH, -Victor.
| | vga Wednesday, December 19, 2007 6:11 AM | You can programatically access recipe arguments with the following code without having to show UI or anything like that:
IDictionaryService dictionary = (IDictionaryService)GetService(typeof(IDictionaryService)); object value = dictionary.GetValue("Framework"); String frameworkLocation = (String)value;
HTH, -Victor.
| | vga Monday, December 17, 2007 3:45 PM | Thank you for your answer. But the problem is the same. The argument filled in my first recipe isn't accessible in my second recipe.
Let me explain the problem in another way.
A user creates a new solution (from my guidance package). He fills a textbox, for exemple "FrameworkName", with the value 'MyNewFramework'. So an argument in the recipe is filled, which for exemple is used to rename the solution. Then the user closes the solution, and reopens it later. How can I store my argument "FrameworkName" if I need it again ? And obviously I don't want to open a wizard each time the user reopens his solution.
Thanks a lot for any help.
-- Matthias
| | malrok Tuesday, December 18, 2007 9:37 AM | You will need to persist the given values for any recipe arguments you're interested in by yourself as there is no built-in mechanism for this in GAX.
There are APIs in VS to persist values to the solution (.sln), solution user options (.suo) and project files (.xxproj) files, each one has it's own PROs and CONs and choosing one will depend on a few factors like if you want to version or not the values, if you want them to be per-user o per-solution, etc, etc. You could of course persist these values to your own custom file too.
If you want to learn more on these APIs I would suggest you get to the MSDN docs and post any doubts to the VS extensibility forum which would be more appropiate because of the topic.
HTH, -Victor.
| | vga Wednesday, December 19, 2007 6:11 AM | Thanks a lot for your answer.
-- Matthias
| | malrok Wednesday, December 19, 2007 8:20 AM |
|