LC.exe file not found during build for .NET 4
I had a problem when migrating to .net 4.0 that gave the following error when trying to build.
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)
The latest version of the microsoft windows sdk is installed on the machine but the version is v7.1. To fix the problem I put the following point the registry key at
HKEY_LOCAL_MACHINE\SOFTWARE\M开发者_如何学Cicrosoft\Microsoft SDKs\Windows\v7.0A\InstallationFolder
to C:\Program Files\Microsoft SDKs\Windows\v7.1\.
This worked however I feel a little dirty about pointing the 7.0A registry key to the 7.1 installation. Does anyone have a better solution to this problem?
Take a look at: Running MSBuild fails to read SDKToolsPath
In one of the answers Simmo suggested seting the default version of the SDK to be 7.1. Version 7.1 of the Windows SDK is newer than the version shipped with Visual Studio 2010 (which is 7.0a). LC.exe is included with 7.1 and once you use WindowsSdkVer.exe to make 7.1 the default version, everything runs fine.
Two minor quirks however: 1) WindowsSdkVer.exe allows you to choose from VS 2005 and VS 2008 but it does not list VS 2010. I simply set the default version for VS 2008 and it worked in 2010.
2) WindowsSdkVer.exe -version:v7.1 did not work for me but WindowsSdkVer.exe without any arguments did, it brought up a windows interface.
I just had this problem and it was because our build server uses VS 2010 to build and I had opened AND modified my solution in VS 2015.
The .sln file's header went from:
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
to
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Apparently this is enough to make tfs (2010 and using visual studio 2010) to want to look for a later version of the sdk tools (which are not installed, in this case v8.0A).
Setting the header in the *.sln file back to the VS 2010 version solved my problem.
精彩评论