将 MSbuild 文件从 4.0 降级到 3.5

发布于 2024-10-31 03:33:27 字数 465 浏览 2 评论 0原文

我有一堆使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

女皇必胜 2024-11-07 03:33:27

我不知道有权威的指南,但我已经做过几次了,我可以说出我所知道的。

对于简单的类库或 WinForms 应用程序,这非常简单:

  1. 项目文件上的 ToolsVersion 需要设置为 3.5,如您所示。
  2. 如果项目文件中存在 OldToolsVersion 元素(意味着它之前已升级),则应将其删除。 FileUpgradeFlagsUpgradeBackupLocation 元素也是如此。基本上,您不希望 OldToolsVersion 与当前版本相同。
  3. 如果您使用的是客户端框架配置文件,则在 3.5 中该元素称为 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:

  1. The ToolsVersion on the project file needs to be set to 3.5, as you indicated.
  2. If there is an OldToolsVersion element (meaning it was previously upgraded) in the project file, it should be removed. The same goes for FileUpgradeFlags and UpgradeBackupLocation elements. Basically, you don't want the OldToolsVersion to be the same as the current version.
  3. If you were using the Client Framework profile, in 3.5 the element is called TargetFrameworkSubset. In 4.0, it's called TargetFrameworkProfile, so the element should be renamed. (Not sure of the applicability to Mono on this one).
旧人九事 2024-11-07 03:33:27

使用MonoDevelop,项目->将解决方案导出为VS2008格式。

Using MonoDevelop, Project->Export the solution to VS2008 format.

素年丶 2024-11-07 03:33:27

您确定要降级 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文