Visual Studio Development Bookmark and Share   
 index > Visual Studio Guidance Automation Toolkit > [GAT Action] VS stops when trying to access recipe arguments
 

[GAT Action] VS stops when trying to access recipe arguments

Hi together!

I am currently lost with a quite trivial problem: read arguments from a recipe

My motivation is to create a strong-name key file. All necessary information to create the file comes from the user. Therefore I use my CreateSolution recipe where I want to use an action called AddStrongNameKey.

Within the recipe I defined two arguments: KeyFileName and SnToolPath (the path to the sn.exe file). Both are used as input variables for my AddStrongNameKey action.

I can rebuild and register the package without any problem but as far as I create a new solution and it has to execute my custom action my vs instance stops to work.

Where is my mistake?! I bound the action to the CreateSolution recipe and defined the variables within the action correctly.

It would be great if someone could give me a hint on that.

Thanks a lot!

Cheers,
Tom

Find my CreateSolution recipe code below:

<Recipe
Name="CreateSolution"
xmlns="http://schemas.microsoft.com/pag/gax-core"
xmlns:xi="http://www.w3.org/2001/XInclude">
<Caption>Collectsinformationforthenewsamplesolution.</Caption>
<Arguments>
<ArgumentName="KeyFileName"Type="System.String"Required="true"/>
<ArgumentName="SnToolPath"Type="System.String"Required="true"/>
<!--<ArgumentName="WebSiteName">
<ConverterType="Microsoft.Practices.RecipeFramework.Library.Converters.NamespaceStringConverter,Microsoft.Practices.RecipeFramework.Library"/>
</Argument>-->
</Arguments>
<GatheringServiceData>
<Wizardxmlns="http://schemas.microsoft.com/pag/gax-wizards"SchemaVersion="1.0">
<Pages>
<Page>
<Title>BSoptFactoryConfiguration</Title>
<Fields>
<FieldLabel="KeyFileName"ValueName="KeyFileName"/>
<FieldLabel="SnToolPath"ValueName="SnToolPath"/>
<!--<EditorType="System.Windows.Forms.Design.FolderNameEditor,System.Design,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"/>-->
<!--</Field>-->
</Fields>
</Page>
</Pages>
</Wizard>
</GatheringServiceData>
<Actions>
<ActionType="MyFactory.Actions.AddStrongNameKey, MyFactory"
Name="AddStrongNameKey">
<InputName="KeyFileName"RecipeArgument="KeyFileName"/>
<InputName="SnToolPath"RecipeArgument="SnToolPath"/>
</Action>
</Actions>
</Recipe>

My custom action called AddStrongNameKey looks like this:

publicclassAddStrongNameKey:Action
{
privatestringkeyFileName;
[Input(Required=true)]
publicstringKeyFileName
{
get{returnthis.keyFileName;}
set{this.keyFileName=value;}
}
privatestringsnToolPath;
[Input(Required=true)]
publicstringSnToolPath
{
get{returnthis.SnToolPath;}
set{this.snToolPath=value;}
}
publicoverridevoidExecute()
{
DTEvs=this.GetService<DTE>(true);
//GettheSoultionItemspathandthekeyfilepath...
stringsolutionPath=(string)vs.Solution.Properties.Item("Path").Value;
stringsolutionDir=Path.GetDirectoryName(solutionPath);
stringsolutionItemsDir=Path.Combine(solutionDir,"SolutionItems");
stringkeyFilePath=Path.Combine(solutionItemsDir,this.KeyFileName);
//Checkifsn.exewascorrectlyprovidedbytheuser...
stringsnPath=Path.Combine(this.SnToolPath,"sn.exe");
MessageBox.Show("KeyFilePath",keyFilePath);
MessageBox.Show("SolutionItemsDir",solutionItemsDir);
//if(!File.Exists(snPath))
//thrownewInvalidOperationException("Couldnotfindsn.exeinthespecifiedfolder"+this.snToolPath+"!");
}
publicoverridevoidUndo()
{
thrownewNotImplementedException();
}
}


Thomas Motal  Monday, November 10, 2008 2:59 PM
Ok, silly me. After spending 2 hours on this problem, checking blogs, forum, google, everything I found and posting my problem to the forum I decided to make a coffee break. Immediately after I came back to my office and had a look at my code I wrote 2 hours ago I saw my mistake ... :

[Input(required=true)]
publicstringSnToolPath{
get{returnthis.SnToolPath;}
}

Of course it should be more like this:

[Input(required=true)]
publicstringSnToolPath{
get{returnthis.snToolPath;}
set{this.snToolPath=value;}
}


Sorry for bothering you with my stupid mistake :-)

Cheers,
Tom
Thomas Motal  Monday, November 10, 2008 3:45 PM
Ok, silly me. After spending 2 hours on this problem, checking blogs, forum, google, everything I found and posting my problem to the forum I decided to make a coffee break. Immediately after I came back to my office and had a look at my code I wrote 2 hours ago I saw my mistake ... :

[Input(required=true)]
publicstringSnToolPath{
get{returnthis.SnToolPath;}
}

Of course it should be more like this:

[Input(required=true)]
publicstringSnToolPath{
get{returnthis.snToolPath;}
set{this.snToolPath=value;}
}


Sorry for bothering you with my stupid mistake :-)

Cheers,
Tom
Thomas Motal  Monday, November 10, 2008 3:45 PM

You can use google to search for other answers

Custom Search

More Threads

• Testing a web site Using Visual studio 2005
• Access is Denied Error when installing Guidance Automation Packages / Guidance Automation Toolkit
• Tom, I see what has been keeping you busy post the E.L.
• One Click
• Install problem on GAX
• How to get the content of buttons
• Application Block Software Factory Templates
• Urgent - Create a new Item (Form)
• Installation: Error 1001
• Some doubts about EnvDTE