locked
Can you add to the default list of items in the Solution Configuration manager? RRS feed

  • Question

  • I have created some basic templates for my team to use when creating web and desktop applications.  One of the things I would like to do is add specific configurations (Like Staging) to the list of possible configurations for all new projects created.  So instead of just having Debug  and Release when creating a new project, I can have Debug, Release, Staging, Testing.

    Does anyone have any insight as to how I can accomplish this?

    Wednesday, December 7, 2011 7:22 PM

Answers

  • Hello Ggary,

    You can add additional Configurations by accessing the Solution. In order to do this you will need to go beyond just creating a a Project Template or a Multi-Project Template, but you will need to implement the IWizard interface. My suggestion to you is to take a look at How to: Use Wizards with Project Templates.  Once you've added a Wizard to your project template, then you can use a DTE object to obtain the Solution and then add a configuration in the ProjectFinishedGenerating method. The code will look something like:

    project.DTE.Solution.SolutionBuild.SolutionConfigurations.Add("Staging","Release",true);
    

    NOTE: If the project object that is passed in as a parameter to ProjectFinishedGenerating is null, you may need to create a member variable for your IWizard class that stores the DTE. You should do this by casting the automationObject in your override of RunStarted something similar to:

    public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
    {
         theDTE = (DTE)automationObject;
    }
    

    Anyway, that should be enough to get you started. and moving along, your first hurdle is to add the Wizard, once you've done that you should be able to manipulate your project in a lot of differnent ways.


    AHA
    • Proposed as answer by akiladila Thursday, December 8, 2011 7:50 AM
    • Marked as answer by Gary Ringenwald Thursday, December 8, 2011 7:21 PM
    Thursday, December 8, 2011 7:50 AM