Tuesday, January 29, 2008

Visual Studio 2008 - New Features - Part 1

In the next few posts - I am going to discuss the new features that are available in Visual Studio 2008, as well as those that are part of C# 3.0 language specification.

VS 2008 Feature : Multi-Targeting Support

Most of us are familiar with platform targeting. This is where we can build a module so that it can run on "Any CPU", "x86" machines and "x64" machines. This platform targeting can be done via the project's "Build" property page.


But to build .NET modules that work with a certain .NET framework - required you to use the appropriate version of Visual Studio

Visual Studio Version .Net Framework Version
VS 2002 1.0
VS 2003 1.1
VS 2005 2.0

This made it a royal pain if you had to support multiple .NET frameworks (which typically required one to keep different versions of project and solution files - for each version of Visual Studio/.Net Framework that one wished to use).

With VS2008 - the multi-targeting support feature allows one to use the IDE to define the target framework. This makes it extremely easy to create .NET modules that target different versions of the .NET framework.

The only caveat - versions 1.0 and 1.1 are not supported. VS2008 allows one to re-target to 2.0, 3.0 and 3.5 versions of .NET.

There are two ways in which one can specify the target .NET framework. When you create a new project, the new project dialog has a combo box that allows you to specify the framework version.


The second method is used to re-target framework version once the project has been already created: Accessed via the project's "Application" property page.


Being able to re-target the framework - doesn't only simplify project management - but also allows you to use all the great features that are part of VS 2008.

The re-targeting is very well integrated into IDE. Once you choose a new framework target the "Add References" dialog will gray out dlls that aren't made for that framework.


In addition - the toolbox will show only those controls that are again meant for that framework.

For more information about this feature check - Scott Gu's blog - VS 2008 Multi-Targeting Support

No comments: