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 SdkT
http://msdn.microsoft.com/en-us/library/ha0k3c9f(v=vs.110).aspx
The License Compiler reads text files that contain licensing information and produces a binary file that can be embedded in a common language runtime executable as a resource. A .licx text file is automatically generated or updated by the Windows Forms Designer whenever a licensed control is added to the form. As part of compilation, the project system will transform the .licx text file into a .licenses binary resource that provides support for .NET control licensing. The binary resource will then be embedded in the project output. Cross compilation between 32-bit and 64-bit is not supported when you use the License Compiler when building your project. This is because the License Compiler has to load assemblies, and loading 64-bit assemblies from a 32-bit application is not allowed, and vice versa. In this case, use the License Compiler from the command line to compile the license manually, and specify the corresponding architecture. This tool is automatically installed with Visual Studio. To run the tool, use the Developer Command Prompt (or the Visual Studio Command Prompt in Windows 7). For more information, see Visual Studio Command Prompt.
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.
I was having the same problem and resolved it by re-installing the Visual Studio.
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"