#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.