【问题标题】:LC.exe file not found during build for .NET 4.NET 4 构建期间未找到 LC.exe 文件
【发布时间】:2011-03-17 04:48:02
【问题描述】:

我在迁移到 .net 4.0 时遇到问题,在尝试构建时出现以下错误。

 C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1917,9): 
  error MSB3086: Task could not find "LC.exe" using the SdkToolsPath "" or the 
  registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.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 

 External Program Failed: C:\windows\microsoft.net\framework\v4.0.30319\MSBuild.exe
 (return code was 1)

机器上安装了最新版本的microsoft windows sdk,但版本是v7.1。为了解决这个问题,我将以下注册表项放在

   HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A\InstallationFolder 
 to C:\Program Files\Microsoft SDKs\Windows\v7.1\. 

这很有效,但是我觉得将 7.0A 注册表项指向 7.1 安装有点脏。有没有人有更好的解决这个问题的方法?

【问题讨论】:

  • 我刚刚遇到了同样的问题。网上有很多变通方法,但我也找不到修复方法。在安装 VS 2010 后安装 Windows SDK 7.1 版时,似乎没有更新相应的路径以指向新目录。

标签: c#


【解决方案1】:

看看:Running MSBuild fails to read SDKToolsPath

Simmo 的答案之一建议将 SDK 的默认版本设置为 7.1。 Windows SDK 7.1 版比 Visual Studio 2010 附带的版本(即 7.0a)更新。 LC.exe 包含在 7.1 中,一旦您使用 WindowsSdkVer.exe 将 7.1 设置为默认版本,一切运行正常。

但是有两个小怪癖: 1) WindowsSdkVer.exe 允许您从 VS 2005 和 VS 2008 中进行选择,但它没有列出 VS 2010。我只是为 VS 2008 设置了默认版本,它在 2010 年运行。

2) WindowsSdkVer.exe -version:v7.1 对我不起作用,但没有任何参数的 WindowsSdkVer.exe 可以,它打开了一个 Windows 界面。

【讨论】:

    【解决方案2】:

    我刚遇到这个问题,这是因为我们的构建服务器使用 VS 2010 构建,而我在 VS 2015 中打开并修改了我的解决方案。

    .sln 文件的标头来自:

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

    Microsoft Visual Studio Solution File, Format Version 12.00
    # Visual Studio 14
    VisualStudioVersion = 14.0.24720.0
    MinimumVisualStudioVersion = 10.0.40219.1
    

    显然这足以让 tfs(2010 和使用 Visual Studio 2010)想要寻找更高版本的 sdk 工具(未安装,在本例中为 v8.0A)。

    将 *.sln 文件中的标头设置回 VS 2010 版本解决了我的问题。

    【讨论】:

      猜你喜欢
      • 2018-01-11
      • 2011-09-04
      • 1970-01-01
      • 2019-05-26
      • 2020-09-16
      • 1970-01-01
      • 2015-11-24
      • 2019-09-09
      • 2015-07-10
      相关资源
      最近更新 更多