#498 – Creating a New Solution Configuration

We saw how to create a new build configuration and, optionally, create a matching solution configuration.  You can also create a new solution configuration and, optionally, create new matching build configurations in each project.

To create a new solution configuration, first open the Configuration Manager.

Now click on the list of solution configurations and select <New…>

You’ll see the New Solution Configuration dialog.  Give the new configuration a name and pick a solution configuration that you want to copy settings from.

After pressing OK, you can set build configuration and platform choices for the new solution configuration.

In the example below, we’ve created a new configuration that uses the same build configuration choices as Debug but builds only the top-level application.

We now see our new solution configuration as a choice in the main solution configurations dropdown.


#497 – Creating a New Build Configuration in a Project

In Visual Studio, you manage both build configurations, for each project, and solution configurations.  The project-level configurations specify sets of build options.  The solution-level configurations specify which project-level configurations are associated with each solution configuration.

You create and edit both project-level and solution-level configurations from the Configuration Manager.

To create a new project-level configuration, you select <New…> from the Configuration dropdown for a specific project.

You then give the new configuration a name and, optionally, copy settings from an existing configuration.

By default, this will create an identically named solution-level configuration.  You can uncheck the Create new solution configurations option to avoid this.  There are cases when you don’t necessarily want a one-to-one mapping between solution-level and project-level configurations.  In the example below, we’ve created a DebugWithWarningsAsErrors option, set appropriate project properties, and then build only one project with this configuration.

#496 – Editing Solution Configurations with the Configuration Manager

You can use the Configuration Manager to view or edit solution configurations in Visual Studio 2010.

In the example below, we have a solution that contains two projects–a DogApplication project that generates an .exe (executable) and a DogLibrary project that generates a .dll (class library).  We’ve opened the Configuration Manager and selected Debug as the solution configuration and x86 as the platform.  We can see that both projects are set to use Debug as their build configuration and x86 as their platform.

We can, however, make a change so that the DogLibrary project is built using its Release configuration, even when the solution configuration is Debug.  We might do this so that we can debug the main application, but use an optimized build of the class library.

#495 – Viewing Solution Configurations with the Configuration Manager

You can edit a solution configuration by using the Configuration Manager.  You can bring up the configuration manager in several different ways.

Select it from build configuration or platform dropdowns:

From the Build menu:

Right-click the solution in Solution Explorer:

By default, the solution configuration will be mapped to corresponding build configuration and platform choices in the default child project.  For example, as you switch between Debug and Release in the solution configuration, you’ll get configurations in which the project’s build configuration is Debug or Release.

#494 – Selecting a Solution-Level Build Configuration and Platform

Visual Studio 2010 supports both solution-level and project-level build configurations.  The project-level configurations specify sets of build-related properties.  The solution-level configuration specifies which projects to build for a particular configuration, as well as the individual project-level configurations to use.

There are also both solution-level and project-level platform choices.

You can see your current solution-level build configuration and platform in the main Visual Studio 2010 toolbar.

In the example below, the current build configuration is Debug and the current platform is Any CPU.

To build your project under a different build configuration or platform, just make a new choice in one or both of these combo boxes.

In the example below, we’ve chosen to do a Release build for the x86 platform.