迁移到.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)
Run Code Online (Sandbox Code Playgroud)
最新版本的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\.
Run Code Online (Sandbox Code Playgroud)
这工作有点但我觉得有点脏将7.0A注册表项指向7.1安装.有没有人有更好的解决方案来解决这个问题?
在其中一个答案中,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界面。