Solution Configuration

Solution configurations store solution level properties and are a key element of the Visual Studio user model. Most importantly, they direct the behavior of the Start (F5) key and Build commands. Both commands execute in the context of a solution configuration. This means that the user can expect F5 to start and build whatever the active solution is configured through the settings. The environment is designed to optimize for solutions rather than projects when it comes to build and run.

The following screenshot shows the default configuration properties for a solution.

Solution configuration properties

Visual Studio Solution Configuration

By default, the F5 and Build behavior in Visual Studio is identical to that of Visual Studio 6.0; that is, the new solution default builds and/or starts the debug configuration.

The standard Visual Studio toolbar contains a Start button (located under the Help menu item in the default Visual Studio configuration) and solution configuration drop-down list box to the right of the Start button. This drop-down list by default allows users to choose either the Debug or Release configuration to be started when F5 is pressed. The user can also access the Configuration Manager (discussed later in this topic) from the drop-down list to create additional configuration options.

The selected item from the toolbar configuration drop-down list indicates the active solution configuration. In the case of the following screenshot, the Active configuration is Release indicating that Release will show in the configuration window of the toolbar.

The user can also select the configuration to be started when F5 is pressed from the Configuration drop-down list show in the Solution Configuration Property Page in the previous screenshot. (A close-up view of the Property Page configuration drop-down list is shown in the following screenshot.)

Solution configuration with Configuration drop-down list box

Visual Studio Solution Config Dropdown

The Configuration drop-down list box contains a list of all the available configurations for the solution. When a new solution is created, the Active Solution Configuration drop-down list contains the following entries by default:

  • Active(Debug)

    备注

    The configuration in parentheses vary depending on the currently selected active configuration.

  • Debug

  • Retail

  • All Configurations

Users can create their own solution configurations to build specific project configurations, set up logical and physical deployment, and select the startup project or projects by opening the Configuration Manager by either clicking the Configuration Manager button on the Solution or Project Property Page, or selecting Configuration Manager from the drop-down list next to the Build button on the toolbar.

备注

There are no VSIP interfaces to create solution configurations programmatically. There are no VSIP APIs for editing the solution configurations. You must use DTE.SolutionBuilder. For more information, see Automation Model. However, there are VSIP APIs for managing the solution build. For more information, see IVsSolutionBuildManager2.

Configuration Manager

Configuration Manager screenshot

From the drop-down list available under Active Solution Configuration, you can select any of the existing solution configurations. Or, you can create a new solution configuration by selecting New from the drop-down list and providing a new configuration name and the existing configuration from which to copy the initial settings. After the new solution configuration is named, you can select which project configurations you want to build.

You can modify existing project configurations by selecting Edit from the drop-down list on the Configuration Manager. This allows you to remove or rename existing configurations.

The Configuration Manager allows you to define startup project configurations including:

  • Project

    Displays the names of projects found in the current solution

  • Configuration

    To provide the list of configurations supported by your project type and displayed in the property pages, implement IVsCfgProvider2.

    The Configuration column displays the name of the project configuration to build in this solution configuration, and lists all of the project configurations when you click the arrow button. The environment calls the GetCfgNames method to fill out this list. If the GetCfgProviderProperty method indicates that the project supports configuration editing, New or Edit selections are also displayed under the Configuration heading. Each of these selections launch dialog boxes that call methods of the IVsCfgProvider2 interface to edit the project's configurations.

    If a project does not support configurations, the Configuration column displays None and is disabled.

  • Platform

    Displays the platform the selected project configuration builds for, and lists all of the available platforms for the project when you click the arrow button. The environment calls the GetPlatformNames method to fill out this list. If the GetCfgProviderProperty method indicates that the project supports platform editing, New or Edit selections are also displayed under the Platform heading. Each of these selections launch dialog boxes that call IVsCfgProvider2 methods to edit the project's available platforms.

    If a project does not support platforms, the platform column for that project displays None and is disabled.

  • Build

    Specifies whether or not the project is built by the current solution configuration. Unselected projects are not built when the solution-level build commands are invoked despite any project dependencies they contain. Projects not selected to be built are still included in debugging, running, packaging, and deployment of the solution.

  • Deploy

    Specifies whether or not the project will be deployed when the Start or Deploy commands are used with the selected solution build configuration. The check box for this field will be available if the project supports deploying by implementing the IVsDeployableProjectCfg interface on its IVsProjectCfg2 object.

Once a new solution configuration is added, the user can select it from the Solution Configuration drop-down list box on the standard toolbar to build and/or start that configuration.

See Also

Concepts

Project Configuration for Building

Project Configuration Object

Other Resources

Managing Configuration Options