Visual Studio 2010 : Understanding Solutions and Projects (part 3)

1/11/2011 4:18:11 PM

5. Using Configuration Manager

You use Configuration Manager to create new build configurations and manage existing configurations for solutions and projects. You use Project Designer to associate a project's properties with its build configuration.

To create a new build configuration by using Configuration Manager, follow these steps:

  1. Choose Configuration Manager from the Build drop-down list.

    Configuration Manager appears, displaying the configuration settings for the configuration and platform selected at the top.

  2. Choose New from the Active solution configuration drop-down list.

    The New Solution Configuration window appears.

  3. Type Staging in the Name field.

  4. Choose Debug from the Copy Settings From drop-down list.

  5. Leave the Create New Project Configurations check box selected.

  6. Click OK.

    The new configuration appears in Configuration Manager, as shown in Figure 6.

    Figure 6. New build configurations appear in Configuration Manager.

A solution's build configuration is composed of two main elements:

  • Project configurations: A set of build-and-debug properties defined for a given project.

  • Platforms: A setting that specifies what hardware platform the build targets.

For each project in the solution, you select a project configuration and a platform, as shown in Figure 6. You create new project configurations and hardware platforms, if necessary. You include the project in the build by placing a check in the Build column. You use Project Designer to set the properties for each project configuration. Figure 7 shows an example of selecting a project configuration for a solution configuration, which you can get to by going to the project properties under the Project menu.

Figure 7. You can set most of the project configuration in Project Designer.

Visual Studio writes the build configurations you create in Configuration Manager to the appropriate solution or project file. When you build your solution or project, MSBuild uses the solution or project files as a script. For example, the following line is added to the solution file for the staging build configuration:

Staging|Any CPU = Staging|Any CPU

Open your solution file or project file in any text editor to view the changes made by Configuration Manager.

If you have a specific hardware platform in mind, you can use Configuration Manager to specify that a build should target that platform. For example, to create a new Debug solution configuration that targets the x64 platform, follow these steps:

  1. Open Configuration Manager.

  2. Choose Debug from the Active Solution Configuration drop-down list.

  3. Choose New from the Active Solution Platform drop-down list.

    The New Solution Platform window appears.

  4. Select x64 as the new hardware platform.

  5. Click OK.

    A new Debug solution configuration for the x64 platform is created.

If you're using the MSBuild Toolkit, you can select a version of the .NET Framework to target using the Platform.

6. Setting project configurations

Visual Studio solutions and projects have many settings — properties — that define the solution or project. These properties define attributes, such as

  • Other code referenced by the project

  • Where to place the project's compiled output

  • Which debugger to use

You access the properties for a solution or project by choosing Properties from the solution's or project's shortcut menu. The two views for properties are

  • Project Designer: Displays properties for a project in Document Explorer. All Visual Studio projects use Project Designer to manage their properties.

  • Property Pages: Displays properties in a dialog box. Solutions and ASP.NET Web sites use the Property Pages window to manage their properties.

ASP.NET Web sites don't use projects, so they don't use Project Designer. Microsoft has a project type (Web Application Projects) that allows you to have ASP.NET projects.

6.1. Using Project Designer

Visual Studio 2010 includes a new feature — Project Designer — that you use to access your project's configuration settings in a single designer.

To open Project Designer, follow these steps:

  1. Right-click your project in Solution Explorer.

    A shortcut menu appears.

  2. Choose Properties.

    Project Designer appears in Document Explorer, showing a set of tabs along the left that group common properties. To access a set of properties, click its tab. Figure 8 shows the Project Designer for a class library project type.

You can also open Project Designer from the Project menu.

Figure 8. This is Project Designer for a class library project.

Some tabs in Project Designer feature properties that you can configure to match your build configuration type. For example, you can set build properties for a Debug build. To set the build properties for a C# project type, follow these steps:

  1. Open Project Designer.

  2. Click the Build tab.

    The project's build properties appear.

  3. Choose a build configuration from the Configuration drop-down list.

    The properties for the selected build configuration appear. If you want to manage properties for all your build configurations, you can choose All Configurations.

  4. Choose a build platform from the Platform drop-down list.

  5. Set properties in Project Designer.

    The properties that you choose depend largely on whether you intend to debug or release the output. The properties for Visual Basic projects are slightly different because the compilers are different.

You won't find an OK or a Save button for Project Designer. The properties are saved immediately.

The Project Designer for Visual Basic project types has a Compile tab instead of a Build tab. You can access build properties from the Compile tab.

You can set unique build configuration settings for properties in the Build and Debug tabs in C# project types. For Visual Basic project types, you set these items on the Build and Compile tabs.

6.2. Using property pages

Solutions and ASP.NET Web sites use the Property Pages dialog box to manage properties. Here's how to use a solution's property pages to set project dependencies:

  1. Right-click the solution in Solution Explorer.

    A shortcut menu appears.

  2. Expand Common Properties.

    A list of properties appears.

  3. Click Project Dependencies.

  4. Choose a project from the Project drop-down list (see Figure 9).

    Your project must have more than one project to set project dependencies.

  5. Check the project dependencies and click OK.

  6. To verify that your projects build in the correct order, choose Projects=>Project Build Order.

    Figure 9. Set project dependencies here.
  •  Becoming an Excel Programmer : Macros and Security
  •  Becoming an Excel Programmer : Where's My Code?
  •  Becoming an Excel Programmer : View Results
  •  Becoming an Excel Programmer : Start and Stop
  •  Windows Server 2008 : Configuring and Monitoring Terminal Service Resources
  •  Visual Studio 2010 : Understanding Debugging
  •  Visual Studio 2010 : Structured Exception Handling to the Rescue
  •  Implement an Observer (aka Subscriber) Pattern
  •  Use a Stopwatch to Profile Your Code
  •  Combine Multiple Events into a Single Event
  •  Internet Security and Acceleration Server 2004 : Additional Configuration Tasks
  •  Windows Server AppFabric
  •  Cloud Application Architectures : Privacy Design
  •  Cloud Application Architectures : Machine Image Design
  •  Windows Azure : Using the Storage Client Library
  •  Windows Azure : Using the Blob Storage API
  •  Windows Azure : Blobs - Usage Considerations
  •  Windows Azure : Understanding the Blob Service
  •  Design and Deploy High Availability for Exchange 2007 : Design Edge Transport and Unified Messaging High Availability
  •  Design and Deploy High Availability for Exchange 2007 : Design Hub Transport High Availability
    Most View
    A Trio From HIS: 7970 IceQ X² GHz Edition, 7950 IceQ X² Boost Clock And 7850 IceQ Turbo X Graphics Cards Review (Part 6)
    Sharepoint 2010 : The SharePoint Security Object Model (part 1)
    How To Buy The Perfect Gear (Part 3) - HDTVs Buying Guide
    Asus Zenbook Prime UX51Vz – An Attractive And Sophisticated Ultrabook (Part 2)
    Truly Transparent Trinkets
    Graphics Card Shootout - Budget FPS (Part 3)
    Panasonic TX-P42GT50 - An Endlessly Watchable Set
    Programming .NET Components : Serialization Events (part 1) - Applying the Event Attributes
    Programming .NET Components : Remoting - Application Domains (part 1)
    Crucial Ballistix Tactical LP And Sport VLP Dual-Channel DDR3 Memory Kits Review (Part 2)
    Top 10
    The Contemporary APUs - AMD Trinity vs Intel Ivy Bridge (Part 11)
    The Contemporary APUs - AMD Trinity vs Intel Ivy Bridge (Part 10)
    The Contemporary APUs - AMD Trinity vs Intel Ivy Bridge (Part 9)
    The Contemporary APUs - AMD Trinity vs Intel Ivy Bridge (Part 8)
    The Contemporary APUs - AMD Trinity vs Intel Ivy Bridge (Part 7)
    The Contemporary APUs - AMD Trinity vs Intel Ivy Bridge (Part 6)
    The Contemporary APUs - AMD Trinity vs Intel Ivy Bridge (Part 5)
    Denon AVR 4520 - Stairway To AV Heaven (Part 2)
    No Sound Left Behind
    Panasonic DMR-BWT720 - Alone In The World But Happy To Be Blu