Visual Studio Development Bookmark and Share   
 index > Visual Studio Guidance Automation Toolkit > The following arguments are required and don't have values
 

The following arguments are required and don't have values

Hi,

In GAX wizards, when an argument is required, you won't be able toclick on the finish button until all the arguments are filled.

I'm not able to get the same result in my custom wizard. When the wizard opens, the finish button is effectively disabled, but if I fill every required values and then I clear one of them, the finish button stays enabled...

The effect of that is this error :

Microsoft.Practices.RecipeFramework.RecipeExecutionException: An exception occurred during the binding of reference or execution of recipe AddBusinessComponentRecipe. Error was: The following arguments are required and don't have values: ApplicationCode. Can't continue execution..
You can remove the reference to this recipe through the Guidance Package Manager.
at Microsoft.Practices.RecipeFramework.Recipe.ThrowIfRequiredArgumentsAreNull(IDictionaryService arguments)
at Microsoft.Practices.RecipeFramework.Recipe.Execute(Boolean allowSuspend)
at Microsoft.Practices.RecipeFramework.GuidancePackage.Execute(String recipe, IAssetReference reference, IDictionary arguments)
at Microsoft.Practices.RecipeFramework.GuidancePackage.ExecuteFromTemplate(String recipe, IDictionary arguments)
at Microsoft.Practices.RecipeFramework.VisualStudio.Templates.UnfoldTemplate.ExecuteRecipe(Boolean executeActions)
at Microsoft.Practices.RecipeFramework.VisualStudio.Templates.UnfoldTemplate.RunFinished()

Here is the code of my argument in my recipe :

<Argument Name="ApplicationCode">
</Argument>

And here is the code behind my wizard concerning this argument :

[RecipeArgument]
public string ApplicationCode
{
set
{
if (value != null)
{
applicationCodeTextBox.Text = value.ToString();
}
else
{
applicationCodeTextBox.Text = "";
}
}
}

private void applicationCodeTextBox_TextChanged(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(applicationCodeTextBox.Text.ToString()))
dictionaryService.SetValue("ApplicationCode", null);
else
dictionaryService.SetValue("ApplicationCode", applicationCodeTextBox.Text.ToString());
}

Am I doing something wrong?

Thanks!

Phil

Philippe Trottier  Friday, May 09, 2008 2:10 PM

I don't know if it's the right way to do, but I found a workaround that does exactly what I wanted.

In the TextChanged method of my argument, I just need to duplicate the SetValue to null like the example below, and that's it!

private void applicationCodeTextBox_TextChanged(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(applicationCodeTextBox.Text.ToString()))

{
dictionaryService.SetValue("ApplicationCode", null);
dictionaryService.SetValue("ApplicationCode", null);
}

else
dictionaryService.SetValue("ApplicationCode", applicationCodeTextBox.Text.ToString());

}

If there is a cleaner way to do this, just tell me!

Philippe Trottier  Friday, May 09, 2008 3:24 PM

I don't know if it's the right way to do, but I found a workaround that does exactly what I wanted.

In the TextChanged method of my argument, I just need to duplicate the SetValue to null like the example below, and that's it!

private void applicationCodeTextBox_TextChanged(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(applicationCodeTextBox.Text.ToString()))

{
dictionaryService.SetValue("ApplicationCode", null);
dictionaryService.SetValue("ApplicationCode", null);
}

else
dictionaryService.SetValue("ApplicationCode", applicationCodeTextBox.Text.ToString());

}

If there is a cleaner way to do this, just tell me!

Philippe Trottier  Friday, May 09, 2008 3:24 PM

You can use google to search for other answers

Custom Search

More Threads

• Change rootnamespace key for guidace packages
• Can instal GAT (and MobileClient! ;( )
• The file cannot be opened with the selected editor
• Gudence Package Error
• GuidanceAutomationExtensions.msi install error
• Resource1.Designer.cs not craeted correctly?
• Value Editor in custom wizard
• Create a single file generation that use T4 template
• Register Guidance Package fails
• NotImplementedException on OnComponentChanging/Changed