Thursday, March 31, 2011

Visual Studio plugin to allow opening 2005 solutions with 2008?

Does anyone know if there's a plugin for Visual Studio 2008 that makes it possible to open VS2005 solutions in a non-destructive way?

What I'm thinking is that the converted project file is kept in memory rather than replacing the original on disk, and .Net framework 2.0 would be targeted by default?

The current behavior requires a complicated conversion process that destroys the original solution file and ends up with a project targeting the newer framework. I want something that would allow developers still using 2005 to continue working on the project.

From stackoverflow
  • The way I've seen this handled in open source projects is to create a solution file for each version of VS. Since the project files (csproj, vbproj, etc) are compatible across versions, you don't need separate versions of those.

    Joel Coehoorn : In that case, do you know a utility that, given a vs2005 solution, can create an equivalent vs2008 solution that still targets .Net 2.0?
    John Sheehan : By default, Visual Studio 2008 will open a 2005 solution and save it to 2008 format without changing the CLR version target. You'd have to manually specify .NET 3.5, it doesn't happen automatically.
  • Just open your 2005 project in 2008 and allow it to upgrade your solution/projects. You may get a dialog asking you to update CLR versions, just say no.

    Once you've got a working 2008 solution, copy the *.sln file to another name (I call my copy *.2005.sln), open the copied *.sln file in notepad, or your favourite text editor. Find "Format Version 10.0" on the 2nd line, and change to "Format Version 9.0". Save the file.

    That's it, your upgraded solution file works in VS 2008, and the one you copied and changed works in VS 2005.

    There's one extra step if you've got Web Application Projects. In the Web Application's vbproj or csproj file, find the line:

    <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplications.targets" Condition="" />
    

    and replace that one line with these two:

    <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v8.0\WebApplications\Microsoft.WebApplications.targets" Condition="'$(Solutions.VSVersion)' == '8.0'" />
    <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplications.targets" Condition="'$(Solutions.VSVersion)' == '9.0'" />
    

    Those two lines will conditionally select the correct MSBuild path depending on the version of VS used.

0 comments:

Post a Comment