将 MSbuild 文件从 4.0 降级到 3.5
我有一堆使用 Visual Studio 2010 创建并针对 .NET 4.0 的 csproj 文件。
我现在尝试使用 xbuild 在 Mono 2.6.7 上进行编译,但是 2.6.7 无法编译 verison 4 msbuild 项目。 (2.10.1没有问题,这是我们一直在使用的,但我想在2.6.7上做一个实验)。
使用 MonoDevelop,我将运行时版本更改为 Mono / .NET 3.5,并且它在 2.6.7 下编译得很好。但是更改为使用 xbuild 失败。
将 MSBuild 版本更改为 3.5 需要执行哪些步骤? csproj 文件中的第一行非常明显:
<Project ToolsVersion="4.0"
更改这一点很容易,但我担心还有一些不太明显的事情也应该更改。
有人知道从 4.0 降级到 3.5 msbuild 文件的明确方法吗?
I've got a heap of csproj files that were created with Visual Studio 2010 and targeted .NET 4.0.
I am now trying to compile on Mono 2.6.7 with xbuild, however 2.6.7 can't compile verison 4 msbuild projects. (2.10.1 has no issues, which is what we've been using, but I want to do an experiment on 2.6.7).
Using MonoDevelop I've changed the Runtime Version to Mono / .NET 3.5, and it compiles fine under 2.6.7. Changing to use xbuild however fails.
What steps are required to change the MSBuild version to 3.5? The top line in the csproj file is pretty obvious:
<Project ToolsVersion="4.0"
And changing that is easy, but I'm concerned there are less obvious things that should also be changed.
Anyone know the definitive way to downgrade from a 4.0 to 3.5 msbuild file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不知道有权威的指南,但我已经做过几次了,我可以说出我所知道的。
对于简单的类库或 WinForms 应用程序,这非常简单:
ToolsVersion
需要设置为 3.5,如您所示。OldToolsVersion
元素(意味着它之前已升级),则应将其删除。FileUpgradeFlags
和UpgradeBackupLocation
元素也是如此。基本上,您不希望OldToolsVersion
与当前版本相同。TargetFrameworkSubset
。在 4.0 中,它称为TargetFrameworkProfile
,因此应重命名该元素。 (不确定这是否适用于 Mono)。I don't know of an authoritative guide, but having done this several times I can say what I know.
For a simple Class Library or WinForms application, it's pretty straight forward:
ToolsVersion
on the project file needs to be set to 3.5, as you indicated.OldToolsVersion
element (meaning it was previously upgraded) in the project file, it should be removed. The same goes forFileUpgradeFlags
andUpgradeBackupLocation
elements. Basically, you don't want theOldToolsVersion
to be the same as the current version.TargetFrameworkSubset
. In 4.0, it's calledTargetFrameworkProfile
, so the element should be renamed. (Not sure of the applicability to Mono on this one).使用MonoDevelop,项目->将解决方案导出为VS2008格式。
Using MonoDevelop, Project->Export the solution to VS2008 format.
您确定要降级 MSBuild 版本吗?只需使用 2.10 进行编译,切换环境到 2.6.7,然后运行测试。
Are you sure you have to downgrade the MSBuild version? Just compile with 2.10, switch your environment to 2.6.7, and run the tests.