Prior to Visual Studio 2008, writing applications for different versions of the Microsoft. NET Framework required the installation of different versions of the Visual Studio development environment. Each version of Visual Studio provides a different developer experience and consumes a lot of disk space. Also, the project file format for each version of Visual Studio is different. The result is that when you develop project components that target different versions of the. NET Framework, you get multiple versions of the project files or solutions.
Visual Studio 2008 is the first version that fully supports multiple targets in a single IDE, allowing developers to write applications that target different versions of the. NET Framework (2.0, 3.0, and 3.5) with one version of Visual Studio. How did it turn out? Developers have a consistent experience, while reducing disk space requirements.
Visual Studio 2008 can achieve multiple goals because each of the available frameworks uses the same underlying CLR 2.0. Also, each version of the framework builds on the. NET Framework 2.0 and provides additional functionality by using the referenced assembly. Ultimately, all frameworks use the. NET Framework 3.5 command line Visual Basic compiler (vbc.exe).
This article discusses the 3.5 and 4 compilers, the compilers that are included in the. NET Framework 3.5 and 4, respectively. The 3.5 compilers are versions that are provided with Visual Studio 2008 and Visual Basic 9, and the 4 compilers are versions that are provided with Visual Studio 2010 and Visual Basic 10.
Let's take a look at how the current multiple goals work in Visual Studio and how you can achieve multiple goals in your project.
Multiple destinations in Visual Studio
In Visual Studio 2008, the goal framework you need to change is simple, just select a target from the Drop-down list in the project properties, as shown in Figure 1. This allows you to add or remove specific references required for each frame version and easily change the framework.
Figure 1 Changing the desired target framework in Visual Studio 2008