Task could not find "LC.exe" using SdkToolsPath
Asked Answered
S

5

6

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.

Sinew answered 29/9, 2014 at 15:35 Comment(3)
From reading the error message, there is no environment variable called SdkToolsPath, or it does exist and the value is empty. So set that value, or fix the registry value.Mage
"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".Thoroughpaced
Possible duplicate of: #2731865Martinmas
F
-4

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.

Fortuity answered 29/9, 2014 at 15:42 Comment(4)
I don't understand how this quote answers the question. Can you add a summary or explanation?Mage
Theres a world of Info there. are you building x86 v x64. what control in your project requires licencing. it was hard to tell from your question if you knew what LC.exe did, and how it related to the project you have cloned. add some more detail and I maybe able to expandFortuity
I don't find this quote helpful at all. For me the problem didn't even have to do with LC.exe, but SdkToolsPath not being set. Furthermore, some of us are trying to compile projects without Visual Studio being installed.Oxus
Although OP has accepted this answer, it doesn't actually answer the question, nor does provide enough details on how to solve the problem. It is a mere copy-and-paste.Bautram
E
6

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"

Entrails answered 27/2, 2018 at 20:39 Comment(0)
G
5

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.

Gigahertz answered 22/9, 2016 at 21:56 Comment(5)
where in .targets did you put that line ?Compulsory
also looks like .targets file is locked out from writing even for administrators hmmmCompulsory
Where in the csproj should this be added? Under which heading?Magritte
<PropertyGroup> <TargetFrameworkSDKToolsDirectory>C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools</TargetFrameworkSDKToolsDirectory> </PropertyGroup>Gazzo
i.e. put it under a <PropertyGroup> tag under the main <Project> tagGazzo
S
0

I was having the same problem and resolved it by re-installing the Visual Studio.

Slaphappy answered 10/10, 2018 at 9:34 Comment(0)
F
0

If you use any third-party code, try to find the "license.licx" file, delete it, and re-build. You should be good.

Faun answered 29/8, 2024 at 11:4 Comment(0)
F
-4

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.

Fortuity answered 29/9, 2014 at 15:42 Comment(4)
I don't understand how this quote answers the question. Can you add a summary or explanation?Mage
Theres a world of Info there. are you building x86 v x64. what control in your project requires licencing. it was hard to tell from your question if you knew what LC.exe did, and how it related to the project you have cloned. add some more detail and I maybe able to expandFortuity
I don't find this quote helpful at all. For me the problem didn't even have to do with LC.exe, but SdkToolsPath not being set. Furthermore, some of us are trying to compile projects without Visual Studio being installed.Oxus
Although OP has accepted this answer, it doesn't actually answer the question, nor does provide enough details on how to solve the problem. It is a mere copy-and-paste.Bautram

© 2022 - 2025 — McMap. All rights reserved.