将MSBuild 3.5与Visual Studio 2010一起使用 [英] Use MSBuild 3.5 with Visual Studio 2010

查看:70
本文介绍了将MSBuild 3.5与Visual Studio 2010一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何强制Visual Studio 2010使用MSBuild 3.5而不是新的4.0?

How can I force Visual Studio 2010 to use MSBuild 3.5 instead of the new 4.0 ?

推荐答案

我认为,如果没有肮脏的黑手,您无法更改Visual Studio中使用的MSBuild版本.

I think you can't change the version of MSBuild used within Visual Studio without a dirty hack.

MSBuild使用的MSBuild任务,目标和工具的版本由项目文件中的 ToolsVersion 属性确定.

The version of MSBuild tasks, targets, and tools used by MSBuild is determined by the ToolsVersion attribute in the project file.

  • Visual Studio 2008使用ToolsVersion ="3.5"
  • Visual Studio 2010使用ToolsVersion ="4.0"

问题:如果您在项目文件上手动将ToolsVersion更改为3.5,Visual Studio 2010将自动将项目文件的ToolsVersion升级到4.0

Problem : If you change the ToolsVersion manually to 3.5 on the project file, Visual Studio 2010 will automatically upgrade the project file's ToolsVersion to 4.0

解决方案是将您的项目ToolsVersion设置为3.6(如果您确实要覆盖MSBuild 4.0,则将其设置为4.0或4.0),然后在注册表中创建以下项:

The solution is to set your project ToolsVersion to 3.6 (or whatever or 4.0 if you really want to override MSBuild 4.0) and then in the registry to create the following key :

  • 注册表配置单元:\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\3.6
  • 字符串键名称:MSBuildToolsPath
  • 字符串键值:.NET Framework 3.5 Install Path(C:\ Windows \ Microsoft.NET \ Framework \ v3.5)
  • Registry Hive: \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\3.6
  • String Key Name: MSBuildToolsPath
  • String Key Value: .NET Framework 3.5 Install Path (C:\Windows\Microsoft.NET\Framework\v3.5)

在ToolsVersion未知的计算机上,将使用默认的ToolsVersion.

On machine where ToolsVersion is unknown, the default ToolsVersion will be used.

有关自定义工具集定义的详细信息.. em>

More information on custom toolset definition.

这篇关于将MSBuild 3.5与Visual Studio 2010一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆