I am using Visual Studio 2013 with an asp.net project. One of the projects gives the error below. Why is it looking for LC.exe in the wrong path? My Windows 8.1 SDK is installed and I have an lc.exe at
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools
and a 64bit version and I have a registry key at
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.1A
I am looking at Microsoft.Common.targets under C:\Windows\Microsoft.NET\Framework\v4.0.30319
and this key exists: SdkToolsPath="$(TargetFrameworkSDKToolsDirectory)"
. Then looked at Microsoft.NetFramework.CurrentVersion.props under
C:\Program Files (x86)\MSBuild\12.0\Bin
and TargetFrameworkSDKToolsDirectory
is defined at $SDK40ToolsPath
. According to MSBuild /v:diag
,
SDK40ToolsPath = C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools
which looks good. The project's target in VS in .NET 4.0.
So why is it still looking at the wrong folder or registry key? The interesting thing is when I rebuild the project after getting the error message, the project builds fine.
Error 5
Task could not find "LC.exe" using the SdkToolsPath
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\"
or the registry key
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0A\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
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets 2428 5 SuperReports
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.
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. This is on Visual Studio 2015, and msbuild being called from ant.
Solution found via MSBuild Using Incorrect Version of sgen.exe to Generate XmlSerializer dlls?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With