Tuesday, September 14, 2010

Combining VS 2008 and VS 2010

This article discusses about how programmers can upgrade to Visua Studio 2010 while the remaining team members on the current project are still using Visual Studio 2008. This document also explains the approach w.r.t to c# and vb.net.

Combining VS 2008 and VS 2010

Programmers can upgrade to VS2010 while the remaining team members on the current project are still using VS in 2008. But in order to do so you need to know a few tricks such as the LangVersion flag.

Step 1:

To begin with a secured copy of the current solution file must be made. This is very important because solution files are not backwards compatible [Note: Project files are backward compatible] Once the copy is created you can perform the usual solution upgrade as if you were permanently moving to a new version of Visual Studio.

Step 2:

Now we need to make sure that the upgrade process should not collapse to the Visual Studio 08 solution. Under the tests we have run so far the only negative effect was a couple of warnings emitted during the build process.

Step 3:

We need to proceed using the VisualStudio.NET 2.0 series of libraries, but the target framework settings are enough to account for that. The notable part is to avoid using any new language features from VB 10 or C# 4. This is where the langversion flag comes into the picture. This flag restricts the compiler to a specific version of the language. For C# that means the 2003 ISO specification, the 2006 ISO specification, or C# 3.0. In Visual Basic you can choose between Visual Basic 9 and Visual Basic 10.

Step 4:

Now, we need to set LangVersion flag as below:

<PropertyGroup><LanguageVersion>2</LanguageVersion></PropertyGroup>

For C#.net, we can get this feature in Advanced Menu > Build Tab

Note: These instructions are mainly for class libraries, console, and Windows applications. ASP.NET projects have their own flukes and may additional issues not addressed here.