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.