Sharing Solutions between VS 2008 and VS 2010

I have a solution with several projects that I currently work on in VS 2008. I would like to use VS 2010 for it instead, to benefit from new debugger features etc… but it should remain on the .NET 3.5 platform, and I would also like to keep things compatible so the solution can be opened and built in VS 2008 later on, if necessary.

I’m sure I haven’t looked at everything yet, and perhaps there will be issues down the line. But it certainly seems that this is pretty simple. Of course, right when you open such a solution in VS 2010, it doesn’t look simple at all: the import wizard comes up and wants to convert your projects. After you’ve done that, VS 2008 won’t open your solution anymore. Hm… so Microsoft doesn’t want you to do this?

Looking at the project (.csproj) files, quite a lot of changes have been made. The version number has been increased, but there’s also lots of new stuff included in the various sections of the file. That looks difficult. The solution (.sln) file on the other hand has only one change made, which is the version number. Now guess which of the two is the one that causes the problem? Wrong.

The problem is in fact the solution file. Although it’s only the version number that has changed, that number is evidently used to prevent opening the solution in an older VS version. Fair enough — until you find out that it is perfectly possible, and apparently even safe, to open the vastly more complex project files in an older VS version. Go figure.

So, the solution I went for is simple: I moved aside the modified .sln file and reverted the old one from svn. Now I have two different .sln files, one for VS 2008 and one for VS 2010. Both include the same projects, and these are in the VS 2010 format. Nevertheless, they work in both versions of VS without a hitch.

There’s one complaint during the build process in VS 2008, which is about the ToolsVersion — this is a parameter in the project file, which has been set to 4.0 by the conversion wizard. Fortunately, msbuild reverts to 3.5 automatically, so there’s no damage done and the build still works just fine. Other than that, I haven’t found any problems yet. I even tried to change project settings in VS 2008, and this leaves the versions intact even though 2008 must be a bit surprised to see 4.0 in there… again, go figure.

4 Comments on Sharing Solutions between VS 2008 and VS 2010

  1. Have you tried opening the vs2008 solution on a computer that does *not* have vs2010 installed?

    Like

  2. Hi Michael,

    No, I haven’t. Are you saying that makes a difference? I wouldn’t expect it to…

    Like

  3. I’ve done the same with VS 2010 Beta 2 but it broke IntelliSense in VS 2008. IntelliSense starts working for a while right after the solution build but then it suddenly stops again. All because of these new tags in .csproj files – after removing them IntelliSense works fine.

    Did they fix that for VS 2010 RC?

    Like

  4. If VS2010 is not installed on the same machine, it will not load in VS2008. The issue is the following line in the csproj file:
    <Import Project=”$(MSBuildExtensionsPath32)MicrosoftVisualStudiov10.0WebApplicationsMicrosoft.WebApplication.targets” />

    As you can see, the Visual Studio v10.0 directory is referenced, and breaks when opened in VS2008.

    Like

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s