6.3. Solution Properties

You can open the Solution Properties dialog by right-clicking the Solution node in the Solution Explorer and selecting Properties. This dialog contains two nodes, Common Properties and Configuration Properties, as shown in Figure 6-2.

If your dialog is missing the Configuration Properties node, you need to check the Show Advanced Build Configurations property in the Projects and Solutions node of the Options window, accessible from the Tools menu. Unfortunately, this property is not checked for some of the setting profiles — for example, the Visual Basic Developer profile. Checking this option not only displays this node, but also displays the configuration selection drop-down in the Project Settings window, discussed later in this chapter.

Figure 6.2. Figure 6-2

The following sections describe the Common Properties and Configuration Properties nodes in more detail.

6.3.1. Common Properties

You have three options when defining the startup project for an application, and they're somewhat self-explanatory. Selecting Current Selection will start the project that has current focus in the Solution Explorer. Single Startup will ensure that the same project starts up each time. (This is the default selection, as most applications have only a single startup project.) The last option, Multiple Startup Projects, allows multiple projects to be started in a particular order. This can be useful if you have a client/server application specified in a single solution and you want them both to be running. When you are running multiple projects, it is also relevant to control the order in which they start up. Use the up and down arrows next to the project list to control the order in which projects are started.

The Project Dependencies section is used to indicate other projects on which a specific project is dependent. For the most part, Visual Studio will manage this for you as you add and remove project references for a given project. However, sometimes you may want to create dependencies between projects to ensure that they are built in the correct order. Visual Studio uses its list of dependencies to determine the order in which projects should be built. This window prevents you from inadvertently adding circular references and from removing necessary project dependencies.

In the Debug Source Files section, you can provide a list of directories through which Visual Studio can search for source files when debugging. This is the default list that is searched before the Find Source dialog is displayed. You can also list source files that Visual Studio should not try to locate. If you click Cancel when prompted to locate a source file, the file will be added to this list.

6.3.2. Configuration Properties

Both projects and solutions have build configurations associated with them that determine which items are built and how. It can be somewhat confusing because there is actually no correlation between a project configuration, which determines how things are built, and a solution configuration, which determines which projects are built, other than that they might have the same name. A new solution will define both Debug and Release (solution) configurations, which correspond to building all projects within the solution in Debug or Release (project) configurations.

For example, a new solution configuration called Test can be created, which consists of two projects: MyClassLibrary and MyClassLibraryTest. When you build your application in Test configuration, you want MyClassLibary to be built in Release mode so you're testing as close to what you would release as possible. However, in order to be able to step through your test code, you want to build the test project in Debug mode.

When you build in Release mode, you don't want the Test solution to be built or deployed with your application. In this case you can specify in the Test solution configuration that you want the MyClassLibrary project to be built in Release mode, and that the MyClassLibraryTest project should not be built.

You can switch between configurations easily via the Configuration drop-down on the standard toolbar. However, it is not as easy to switch between platforms, as the Platform drop-down is not on any of the toolbars. To make it available, select View Toolbars Customize. From the Build category on the Commands, the Solution Platforms item can be dragged onto a toolbar.

You will notice that when the Configuration Properties node is selected from the Solution Properties dialog, as shown in Figure 6-2, the Configuration and Platform drop-down boxes are enabled. The Configuration drop-down contains each of the available solution configurations (Debug and Release by default), Active, and All. Similarly, the Platform drop-down contains each of the available platforms (any CPU by default), Active, and All. Whenever these drop-downs appear and are enabled, you can specify the settings on that page on a per-configuration and/or per-platform basis. You can also use the Configuration Manager button to add additional solution configurations and/or platforms.

When you are adding additional solution configurations, there is an option (checked by default) to create corresponding project configurations for existing projects (projects will be set to build with this configuration by default for this new solution configuration), and an option to base the new configuration on an existing one. If the Create Project Configurations option is checked and the new configuration is based on an existing one, the new project configurations will be the same as those specified for the existing configuration.

The options available for creating new platform configurations are limited by the types of CPUs available: Itanium, x86, and x64. Again, the new platform configuration can be based on existing configurations, and the option to create project platform configurations is also available.

The other thing you can specify in the solution configuration file is the type of CPU for which you are building. This is particularly relevant if you want to deploy to 64-bit architecture machines.

All these solution settings can be reached directly from the right-click context menu from the Solution node in the Solution Explorer window. While the Set Startup Projects menu item opens the Solution Configuration window, the Configuration Manager and Project Dependencies items open the Configuration Manager and Project Dependencies windows, respectively. Interestingly, an additional option in the right-click context menu, the Build Order, doesn't appear in the solution configuration. When selected, this opens the Project Dependencies window, which lists the build order in a separate tab, as shown in Figure 6-3. This tab reveals the order in which projects will be built, according to the dependencies. This can be useful if you are maintaining references to project output DLLs rather than project references, and you can use it to double-check that projects are being built in the correct order.

Figure 6.3. Figure 6-3

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.57.126