Mixing Visual Studio 2008 and 2010

| by Jonathan Allen 187 Followers on Aug 11, 2010. Estimated reading time: 1 minute |

Developers can upgrade to Visual Studio 2010 while other team members on the same project are still using Visual Studio in 2008. But in order to do so you need to know a few tricks such as the langversion flag.

To begin with a copy of the current solution file must be made. This is necessary because, unlike project files, solution files are not backwards compatible. Once the copy is made you can perform the usual solution upgrade as if you were permanently moving to a new version of Visual Studio.

The next step is to ensure that the upgrade process didn’t break to the VS 2008 solution. Under the tests we have run so far the only negative effect was a couple of warnings emitted during the build process.

You will have to continue using the .NET 2.0 series of libraries, but the normal target framework settings are enough to account for that. The tricky part is to avoid using any new language features from VB 10 or C# 4. This is where the langversion flag comes into play. 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 VB 9 or VB 10.

C# allows you to set this flag in the Advanced menu of the Build tab. For Visual Basic you will have to manually edit the project file so that it includes the below line.

<PropertyGroup> <LangVersion>9</LangVersion> </PropertyGroup>

Please note that these instructions are primarily for class libraries, console, and Windows applications. ASP.NET projects have their own quirks and may additional issues not addressed here.

Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Close

by

on

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.