Share via


Developing Recipes

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies.
This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Recipes automate development activities that the developer would usually have to perform manually, often following a series of instructions, to ensure that they are performed in an approved way. For more information about the role recipes play in the Guidance Automation Toolkit, see Understanding Recipes.

Recipes are defined in an XML Guidance Package configuration file. Each Guidance Package has one Guidance Package configuration file. Recipes must have unique names within a Guidance Package; they can be referenced by that name in Visual Studio templates. Recipe references can also be created programmatically from an action called by another recipe.

Each Guidance Package configuration file usually contains a definition of a binding recipe. This binding recipe is executed by the Recipe Framework when the Guidance Package is enabled. The configuration file also contains definitions for the other recipes included with the Guidance Package. These definitions are defined in the same way. The recipes element of the XML Guidance Package configuration file has the following overall structure:

<Recipes>
  <Recipe Name="CreateSolution">
    <DocumentationLinks>
      <Link Caption="Description" Url="https://localhost:8080/MyPackageOne/CreateSolutionRecipe" Kind="Documentation"/>
    </DocumentationLinks>
    <Caption>Collects information for the new sample solution.</Caption>
    <Arguments>
      <Argument Name="ProjectName">
        <Converter Type="Microsoft.Practices.RecipeFramework.Library.Converters.NamespaceStringConverter, Microsoft.Practices.RecipeFramework.Library"/>
      </Argument>
    </Arguments>
    <GatheringServiceData>
      <Wizard xmlns="https://schemas.microsoft.com/pag/gax-wizards" SchemaVersion="1.0"  Help="https://localhost:8080/MyPackageOn/CreateSolutionWizard ">>>
        <Pages>
          <Page>
            <Title>Initial values for the new solution</Title>
            <Fields>
              <Field Label="Project Name" ValueName="ProjectName" />
            </Fields>
          </Page>
        </Pages>
      </Wizard>
    </GatheringServiceData>
    <Actions>
      <Action Name="NoOp" Type="PackageNamespace.Actions.DoNothingAction, PackageName" />
    </Actions>
  </Recipe>
</Recipes>

When you create a new Guidance Package from the Guidance Package Development template, the Guidance Package configuration file includes definitions for a number of recipes that you can use or modify, according to your own requirements. In addition to the binding recipe, the following recipes are included:

  • CreateSolution. This bound recurring recipe collects information for the solution that is generated from the template that is created when the Guidance Package is built.
  • Add Main Class. This bound non-recurring recipe adds a class file with T4 generated content. This content contains the main method.
  • GenerateRepeatingClassT4. This unbound recipe adds a class with T4 generated content. This content contains statements that are dynamically generated using argument values.
  • NewItemClass. This recipe collects information for creating a new class.
  • HelloWorldRecipe. This recipe displays a message.
  • CustomWizardPages. This bound recipe shows a simple example of the use of custom wizard pages.
  • AddItemTemplateReference. This unbound recipe adds an item template reference to the selected project.
  • AddProjectTemplateReference. This unbound recipe that associates adds a project template reference to the selected solution folder or the root.
  • RecipeWithInitalState. This recipe called from the unfolding of a .vstemplate file
  • InitialStateSerializableClass. This recipe is loaded with preset values from an invoking .vstemplate file
  • AddRecipeReference. This recipe adds a recipe reference to the solution root or a solution folder, project, project folder, project item, Web project, Web folder, or Web item.
  • ShowCurrentSelection. This recipe shows a message box with the name of the selected solution element.

Note

The Recipe Framework enforces a limit of 256 recipes in a Guidance Package.
For how to use XInclude in the Guidance Package Configuration file see Using XInclude.

This section specifies the key elements to create recipes for use by the Guidance Automation Toolkit. It includes the following:

See also

Specifying Command Bars | Specifying Bound References | Specifying Unbound References | Writing Argument Value Providers | The AddMainClass Recipe | Using XInclude | Documenting Recipes to Show in the Guidance Navigator