Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Task could not find "LC.exe" using SdkToolsPath

I have cloned a project to my computer using TFS, when I build the project I get this error :

Error 6 Task could not find "LC.exe" using the SdkToolsPath "" or the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.1A\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

I have searched the web but couldn't find a solution. I use VS 2013 and .NET 4. How can I fix this? Thanks.

like image 723
jason Avatar asked Sep 29 '14 15:09

jason


2 Answers

If you're using MSBuild.exe to build projects from the command line, you can pass TargetFrameworkSDKToolsDirectory as a parameter to avoid having to edit your .csproj files. For example: MSBuild.exe mysolution.sln /t:build /p:TargetFrameworkSDKToolsDirectory="C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools"

like image 100
Ryan Avatar answered Sep 24 '22 09:09

Ryan


It turns out you can specify the path to the SDK directly in the .csproj file:

<TargetFrameworkSDKToolsDirectory>C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools</TargetFrameworkSDKToolsDirectory>

and the build found lc.exe that way. So do a dir /s for lc.exe and use that path.

I previously expected to set this using <SdkToolsPath>, but that didn't work. In Microsoft.Common.targets, SdkToolsPath gets set from TargetFrameworkSDKToolsDirectory, so I tried that and it worked. (It would be nice if the variable name corresponded 1 to 1, but they don't.)

This is on Visual Studio 2015, and msbuild being called from ant.

like image 38
TomEberhard Avatar answered Sep 23 '22 09:09

TomEberhard