#487 – Build Configurations Allow Saving Sets of Project Properties

In Visual Studio, a build configuration represents a set of saved properties that affect the build process.

A build configuration can be associated with a solution or with individual projects.

A build configuration at the solution level dictates which projects to build for that configuration, which build configurations to use for individual projects, and which platform to build each project for.

At the project level, a build configuration allows setting different project properties for each configuration.  For example, a “Debug” configuration might be configured to define the DEBUG constant and generate full symbols for debugging purposes.

You select the current build configuration to use by selecting an item from the Solution Configurations dropdown in the main toolbar.

You can also select Configuration Manager from the Build menu and then change the configuration in the Active solution configuration dropdown.

Advertisement

#114 – Creating a New Build Configuration

Visual Studio projects are created with two build configurations–Debug and Release.

You can also create your own build configurations.  You might do this if you wanted to easily be able to build with a particular symbol defined, which in turn triggers conditional compilation.

To create a configuration, click on the Configuration Manager… option in the configurations dropdown.  A manager window appears.

Click on the configuration dropdown at the left and select New.

Give the new configuration a name and select a configuration to copy from.  Click OK.

Close the configuration manager and open the project properties dialog.  You’ll see your new configuration listed in the configuration dropdown.

You can now define a symbol that exists only in this new configuration.

And then define code that gets compiled if the new symbol is defined.

#if LOGGING
    DoSomeLogging();   // To assist in debugging
#endif