Visual Studio plugin to allow opening 2005 solutions with 2008?

≡放荡痞女 提交于 2019-12-11 18:27:22

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/554007/visual-studio-plugin-to-allow-opening-2005-solutions-with-2008

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!