Ask a questionAsk a question
 

AnswerAdd guadiance automation to existing solution?

  • Thursday, September 17, 2009 9:25 AMAlbin123 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,
    I've created GA package which creates whole solution with some projects. Every project has bound some recipes on its context menu. Everything works fine. But I'd like to use my package with existing solution, not created from this package. Every solution has the same projects structure, and using project name i can specify which recipes should be bound to it.  Maybe someone has an idea how to achieve that functionality?
    I'm working on VS2008...
    thanks for help!

Answers

  • Monday, September 21, 2009 8:54 AMKevinH1979 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi

    I had a similar problem and resolved it as follows. I created a new unbound recipe called "BindRecipesToExistingSolution". I instructed the developers to use the "Guidance Package Manager" option in Visual Studio to enable my guidance package on the existing solution. Once my guidance package is enabled the unbound recipes will be available in the Guidance Package Manager window. I instructed the developers to then execute my BindRecipesToExistingSolution recipe. It asks the developers to associate the names of the projects in the existing solution to arguments in the recipe.

    I then used a custom action to associate the recipes / templates to the projects:

    <Action Type="Test.GuidedAutomation.Actions.AddNewBoundReferenceToProject, TestCGuidancePackage" Name="AddCreatorRecipe">

    <

     

    Input Name="CurrentProject" RecipeArgument="CreatorProject" />

    <

     

    Input Name="RecipeName" RecipeArgument="CreatorRecipeName" />

    <

     

    Input Name="TemplateName" RecipeArgument="CreatorTemplateName" />

    </

     

    Action>


    My custom action code looks like this. I firstly add a bound reference to the project using the reference service.

     

    IBoundAssetReference addedReference;

     

    // firstly add a new bound reference in the given project for the given recipe

     

    DTE vs = GetService<DTE>(true);

     

    IAssetReferenceService referenceService = GetService<IAssetReferenceService>(true);

    addedReference =

    new ProjectReference(recipeName, currentProject);

    referenceService.Add(addedReference);


    then I needed to add a new BoundTemplateReference to associate the given template with the given project (where templatePath is a path to wherever my templates are installed)

    VsBoundReference vsTarget = null;

    vsTarget =

    new ProjectReference(templatePath, currentProject);

     

    IBoundAssetReference newReference = new BoundTemplateReference(templatePath, vsTarget);

    referenceService.Add(newReference);

    Hope this helps ...
    K









     

     

    • Marked As Answer byAlbin123 Thursday, September 24, 2009 1:15 PM
    • Proposed As Answer byKevinH1979 Monday, September 21, 2009 8:54 AM
    •  

All Replies

  • Monday, September 21, 2009 8:54 AMKevinH1979 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi

    I had a similar problem and resolved it as follows. I created a new unbound recipe called "BindRecipesToExistingSolution". I instructed the developers to use the "Guidance Package Manager" option in Visual Studio to enable my guidance package on the existing solution. Once my guidance package is enabled the unbound recipes will be available in the Guidance Package Manager window. I instructed the developers to then execute my BindRecipesToExistingSolution recipe. It asks the developers to associate the names of the projects in the existing solution to arguments in the recipe.

    I then used a custom action to associate the recipes / templates to the projects:

    <Action Type="Test.GuidedAutomation.Actions.AddNewBoundReferenceToProject, TestCGuidancePackage" Name="AddCreatorRecipe">

    <

     

    Input Name="CurrentProject" RecipeArgument="CreatorProject" />

    <

     

    Input Name="RecipeName" RecipeArgument="CreatorRecipeName" />

    <

     

    Input Name="TemplateName" RecipeArgument="CreatorTemplateName" />

    </

     

    Action>


    My custom action code looks like this. I firstly add a bound reference to the project using the reference service.

     

    IBoundAssetReference addedReference;

     

    // firstly add a new bound reference in the given project for the given recipe

     

    DTE vs = GetService<DTE>(true);

     

    IAssetReferenceService referenceService = GetService<IAssetReferenceService>(true);

    addedReference =

    new ProjectReference(recipeName, currentProject);

    referenceService.Add(addedReference);


    then I needed to add a new BoundTemplateReference to associate the given template with the given project (where templatePath is a path to wherever my templates are installed)

    VsBoundReference vsTarget = null;

    vsTarget =

    new ProjectReference(templatePath, currentProject);

     

    IBoundAssetReference newReference = new BoundTemplateReference(templatePath, vsTarget);

    referenceService.Add(newReference);

    Hope this helps ...
    K









     

     

    • Marked As Answer byAlbin123 Thursday, September 24, 2009 1:15 PM
    • Proposed As Answer byKevinH1979 Monday, September 21, 2009 8:54 AM
    •  
  • Thursday, September 24, 2009 1:15 PMAlbin123 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Exactly what i need! Great thanks!