I am developing a Guidance Package to better formulate some development methodologies.  I believe one of the ways to do this is to give developers a cookie cutter approach to some redundant tasks.  One of these is to create a basic solution to work from.  For this post, my end goal is to create a blank solution with some solution folders attached to it.


To Begin

  1. Create a new guidance package from visual studio.  I am assuming that the GAT and GAX have been installed. 
    • Modify the XML configuration file by removing all of the recipes. The end result should look something like this:


    • Clean out all content (Besides the XML configuration file) from the Package, but leave the directory structure in place.  This has a direct affect on the build process.
    • Build the Solution.  You should have a clean build at this point
  2. Create a new Solution vstemplate file underneath the templates\solutions folder.  Below is the text for the file.
    <VSTemplate Version=”2.0.0″ Type=”ProjectGroup” xmlns=”http://schemas.microsoft.com/developer/vstemplate/2005″>
        <Name>Basic Solution Template</Name>
        <Description>Creates a Basic Solution with attached recipes</Description>
          <SolutionFolder Name=”src”> 
        <Assembly>Microsoft.Practices.RecipeFramework.VisualStudio, Version=1.0.51206.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>
        <Template xmlns=”http://schemas.microsoft.com/pag/gax-template” SchemaVersion=”1.0″ Recipe=”NewSolution”>

    Replace the following items in this template data with your own content.

    • Icon – Provide an Icon in the same folder structure where your solution template file is.  This is what will show up in Visual Studio.
    • DefaultName – This is the default name for the solution when the user creates a new solution.
    • Notice the SolutionFolder named src.  Create your own solution directory tree here.  For the purposes of this example, I am adding a src folder so that I can add recipes against it.Save the file

      Other items of note:  A normal solution template does not include the WizardExtension node.  This is what tells the GAX to execute recipes.  We currently have this solution tied to the NewSolution recipe.  Lets save the file and add the recipe to the XML configuration.

  3. Open up the XML configuration file and add the following contents in the GuidancePackage Node:
  4. <Recipes>
      <Recipe Name=”NewSolution”>
        <Caption>Build a new Solution</Caption>

  5. Save the file and rebuild the solution.  Ensure that the solution fully builds, if not you could have corruption issues.
  6. At this point we are ready to register the package. Right-Click on the class library project and select Register Guidance Package.  Once the Guidance Package is registered successfully, open another instance of Visual Studio. You should now see your own package.

You have now completed creating a basic Guidance Package with a custom solution.  Further post will show how to add custom recipes to specific solution folders.

Technorati Tags: , ,