visual-studio 如何将 VS 2010 解决方案转换回 2008

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1898325/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 11:19:16  来源:igfitidea点击:

How to convert a VS 2010 solution back to 2008

visual-studiovisual-studio-2010

提问by Ali Shafai

We started using VS 2010 and were very happy with it, so we converted our project into a 2010 solution (still .net 3.5) and continued our development in 2010. However, we are getting a lot of bugs recently and want to go back to 2008. The solution files have changed (new projects and files added everywhere), but everything is still in .net 3.5. I was wondering if there is an easy way to migrate back to 2008.

我们开始使用 VS 2010 并且对它非常满意,所以我们将我们的项目转换为 2010 解决方案(仍然是 .net 3.5)并在 2010 年继续我们的开发。但是,我们最近遇到了很多错误,想回到2008. 解决方案文件已更改(随处添加新项目和文件),但所有内容仍在 .net 3.5 中。我想知道是否有一种简单的方法可以迁移回 2008 年。

回答by GrayWizardx

Depending on if they kept the solution file structure similar between 2008 and 2010, you just need to create an empty solution file in 2008 and look at the top identifier line in it, and copy it into the other solution file.

根据他们是否在 2008 年和 2010 年之间保持解决方案文件结构相似,您只需要在 2008 年创建一个空的解决方案文件并查看其中的顶部标识符行,并将其复制到另一个解决方案文件中。

I however doubt they kept it the same since they were integrating a number of features into solution files.

然而,我怀疑他们是否保持不变,因为他们将许多功能集成到解决方案文件中。

You would be better off to create a new blank solution in 2008 and use "Add existing project" to reimport them. As long as you dont have any custom "solution" wide references this will work (no solution folders, server setups, etc).

您最好在 2008 年创建一个新的空白解决方案并使用“添加现有项目”重新导入它们。只要您没有任何自定义的“解决方案”广泛引用,这将起作用(没有解决方案文件夹、服务器设置等)。

It is probably the fastest and most direct route.

这可能是最快和最直接的路线。

回答by Calciol

I had success changing the first 2 lines from:

我成功地改变了前两行:

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010

to

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008

回答by ChrisF

Assuming that your solution is under source control and the migration from VS 2008 to VS 2010 was the only change in that checkin, just compare the two version and see what's changed.

假设您的解决方案受源代码控制,并且从 VS 2008 迁移到 VS 2010 是该签入中的唯一更改,只需比较两个版本,看看有什么变化。

Then change the lines affected back to the VS 2008 version and you should be good to go.

然后将受影响的行改回 VS 2008 版本,您应该很高兴。

There's no automatic process as Microsoft see this as a one way operation.

没有自动过程,因为 Microsoft 认为这是一种单向操作。

回答by Evgeny Gavrin

You can manually edit .sln file in text editor. There is field named version, or like that, just change it from 10 to 9.

您可以在文本编辑器中手动编辑 .sln 文件。有一个名为 version 的字段,或者类似的,只需将其从 10 更改为 9。

回答by Chris Fulstow

This question

这个问题

How does one convert a Visual Studio .NET 2008 solution to Visual Studio .NET 2005?

如何将 Visual Studio .NET 2008 解决方案转换为 Visual Studio .NET 2005?

might also be applicable for converting from 2010 back to 2008.

也可能适用于从 2010 年转换回 2008 年。

回答by Opera362

You can use "Project Converter": http://www.emmet-gray.com/Articles/ProjectConverter.htm

您可以使用“项目转换器”:http: //www.emmet-gray.com/Articles/ProjectConverter.htm

I have just found it. I am going to test it right now! :-)

我刚刚找到了。我现在就去测试!:-)

回答by Santosh Thakur

Please try the following (find first line and replace to second line to convert 2010 solution to 2008):

请尝试以下操作(找到第一行并替换为第二行以将 2010 解决方案转换为 2008):

TargetFrameworkMoniker = ".NETFramework,Version=v2.0"
TargetFramework = "3.5"

# Visual Studio 10
# Visual Studio 2008

Microsoft Visual Studio Solution File, Format Version 11.00
Microsoft Visual Studio Solution File, Format Version 10.00

<Project ToolsVersion="4.0"
<Project ToolsVersion="3.5"

<ProductVersion>10.0.20506</ProductVersion>
<ProductVersion>9.0.30729</ProductVersion>

\VisualStudio\v10.0\
\VisualStudio\v9.0\

<Import Project="$(MSBuildToolsPath)\Workflow.Targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets" />

This worked on my solutions, you can try to see if it fit to your cases.

这适用于我的解决方案,您可以尝试查看它是否适合您的情况。

回答by Santosh Thakur

as maZZoo tells, you have to replace those lines in .sln, but if you check you Output panel you may have an alert of using ToolsVersion="4.0", you have to replace that in the .csprojto:

正如 maZZoo 所说,您必须替换 .sln 中的那些行,但是如果您检查输出面板,您可能会收到使用ToolsVersion="4.0"的警报,您必须将.csproj 中的内容替换为:

<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">