gpt4 book ai didi

visual-studio - 为什么 Visual Studio 2013 对 lc.exe 使用错误的 SdkToolsPath?

转载 作者:行者123 更新时间:2023-12-04 14:58:04 24 4
gpt4 key购买 nike

我正在将 Visual Studio 2013 与 asp.net 项目一起使用。其中一个项目给出了以下错误。
为什么它在错误的路径中寻找 LC.exe?我的 Windows 8.1 SDK 已安装,并且我有一个 lc.exe

C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools

和一个 64 位版本,我有一个注册表项在
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.1A

我正在查看 C:\Windows\Microsoft.NET\Framework\v4.0.30319 下的 Microsoft.Common.targets并且此 key 存在: SdkToolsPath="$(TargetFrameworkSDKToolsDirectory)" .然后看了下Microsoft.NetFramework.CurrentVersion.props
C:\Program Files (x86)\MSBuild\12.0\Bin

TargetFrameworkSDKToolsDirectory定义在 $SDK40ToolsPath .根据 MSBuild /v:diag ,
SDK40ToolsPath = C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools 

这看起来不错。 .NET 4.0 中 VS 中的项目目标。

那么为什么它仍在查看错误的文件夹或注册表项?有趣的是,当我在收到错误消息后重建项目时,项目构建得很好。
Error   5   
Task could not find "LC.exe" using the SdkToolsPath
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\"
or the registry key
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx40Tools-x86".
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
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets 2428 5 SuperReports

最佳答案

事实证明,您可以直接在 .csproj 文件中指定 SDK 的路径:
<TargetFrameworkSDKToolsDirectory>C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools</TargetFrameworkSDKToolsDirectory>
并且构建以这种方式找到了 lc.exe。

我以前希望使用 <SdkToolsPath> 来设置它,但这没有用。在 Microsoft.Common.targets 中,SdkToolsPath 是从 TargetFrameworkSDKToolsDirectory 设置的,所以我尝试了它并且它起作用了。这是在 Visual Studio 2015 上,并且从 ant 调用 msbuild。

通过 MSBuild Using Incorrect Version of sgen.exe to Generate XmlSerializer dlls? 找到的解决方案

关于visual-studio - 为什么 Visual Studio 2013 对 lc.exe 使用错误的 SdkToolsPath?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26442450/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com