Search code examples
visual-studiocommand-lineconfigurationbuildautomation

Where is the currently selected "Solution Configuration" option stored in VS 2010 or 2012?


In VS 2010, or VS 2012, you can pick a "Solution Configuration", that has been custom defined, that can define local variables used with the #if #elif #endif syntax to change your code dynamically through that drop down. Also in that configuration, you can choose whether it's built or deployed, platform you're targeting, and the local configuration you want to use per project.

When you choose a configuration, then close Visual Studio, and re-open Visual Studio, it remembers what configuration you chose, what I can't seem to figure out, is where it saves/stores that configuration information, and I need to automate it.

Does anyone know of either:

  • A way to use the command line compiler to automate solution level builds using solution configurations
  • Where Visual Studio stores the currently selected configuration information
  • Or, ideally, both?

Solution

  • A way to use the command line compiler to automate solution level builds using solution configurations

    msbuild.exe /p:Configuration="Solution Config" /p:Platform="Solution Platform"
    

    For example, you can do:

    msbuild.exe /p:Configuration="Release" YourSolution.sln
    

    To build the "Release" configuration.

    Where Visual Studio stores the currently selected configuration information

    This is stored in the user's .suo file, next to the .sln (solution) file.