Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LC.exe file not found during build for .NET 4

Tags:

c#

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\Microsoft\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?

like image 272
park896 Avatar asked Jul 16 '10 22:07

park896


1 Answers

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.

like image 51
JonnyBoats Avatar answered Oct 05 '22 20:10

JonnyBoats