用户登录
用户注册

分享至

运行 MSBuild 无法读取 SDKToolsPath

  • 作者: 好快的时间
  • 来源: 51数据库
  • 2023-02-13

问题描述

您好,在使用 VS2008 及其相关工具进行编译时,我在运行用于正确构建基于 .Net 2.0 的网站的 NAnt 脚本时遇到了一些问题.我最近将所有项目/解决方案文件升级到 VS2010,现在我的构建失败并出现以下错误:

Howdy, I'm having a bit of an issue runnning a NAnt script that used to properly build my .Net 2.0 based website, when compiling with VS2008 and it's associated tools. I've recently upgraded all the project/solution files to VS2010, and now my build fails with the following error:

[执行]C:WindowsMicrosoft.NETFramework64v4.0.30319Microsoft.Common.targets(2249,9):错误 MSB3086:找不到任务"sgen.exe" 使用 S dkToolsPath ""或注册表项"HKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoftSDKsWindowsv7.0A".确保SdkToolsPath 设置和工具存在于正确的处理器中下的具体位置SdkToolsPath 和 Microsoft已安装 Windows SDK

[exec] C:WindowsMicrosoft.NETFramework64v4.0.30319Microsoft.Common.targets(2249,9): error MSB3086: Task could not find "sgen.exe" using the S dkToolsPath "" or the registry key "HKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft SDKsWindowsv7.0A". Make sure the SdkToolsPath is set and the tool exists in the correct processor specific location under the SdkToolsPath and that the Microsoft Windows SDK is installed

现在,我确实在构建服务器上安装了 Windows SDK 的早期版本 (.Net 3.5),并且安装了完整的 .Net 4.0 框架,但我没有运行过特定于 .Net 4.0 版本的Windows SDK.

Now, I DO have prior versions (.Net 3.5) of the Windows SDK installed on the build server, and the full .Net 4.0 framework is installed, but I've not run across a .Net 4.0 specific version of the Windows SDK.

经过一番实验和研究,我终于设置了一个新的环境变量SDKToolsPath",并将其指向我的 windows 6.0 sdk 文件夹中的 sgen.exe 副本.这产生了相同的错误,但它让我注意到即使设置了 SDKToolsPath 环境变量(确认我可以在命令行回显"它并且它具有预期值),错误消息似乎表明它是没有被阅读(注意空引号).

After a bit of experimentation and research, I finally just setup a new environmental variable "SDKToolsPath" and pointed it to the copy of sgen.exe in my windows 6.0 sdk folder. This generated the same error, but it got me to notice that even though the SDKToolsPath environmental variable IS set (confirmed that I can "echo" it at the command line and it has the expected value), the error message seems to indicated that it's not being read (note the empty quotes).

我发现的大部分信息都是特定于 .Net 3.5(或更早版本)的.目前还没有多少与 4.0 相关的内容.搜索错误代码 MSB3086 也没有任何用处.知道这可能是什么吗?

Most of the information I've found is .Net 3.5 (or earlier) specific. Not much 4.0 related out there yet. Searching for error code MSB3086 generated nothing useful either. Any idea what this might be?

斯科特

推荐答案

我不得不硬着头皮在我们的构建服务器上安装 VS 2010 来解决这个问题.据我所知,MSDN 上的任何地方都没有 7.0A 版本的 Windows SDK.但是,安装 VS 2010 似乎会安装它,在 Program FilesMicrosoft SDKsWindows 中创建一个 7.0A regkey 和一个 7.0A 文件夹.

I had to bite the bullet and install VS 2010 on our build server to fix this issue. As far as I can see, there's no 7.0A version of the Windows SDK available anywhere on MSDN. However, installing VS 2010 appears to install it, creating a 7.0A regkey and a 7.0A folder in Program FilesMicrosoft SDKsWindows.

软件
前端设计
程序设计
Java相关