title: Why is Visual Studio 2013 using the wrong SdkToolsPath for lc.exe?
body: <p>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 </p>
  
  <pre><code>C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools
  </code></pre>
  
  <p>and a 64bit version and I have a registry key at </p>
  
  <pre><code>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.1A
  </code></pre>
  
  <p>I am looking at Microsoft.Common.targets under <code>C:\Windows\Microsoft.NET\Framework\v4.0.30319</code> and this key exists: <code>SdkToolsPath="$(TargetFrameworkSDKToolsDirectory)"</code>. Then looked at Microsoft.NetFramework.CurrentVersion.props under </p>
  
  <pre><code>C:\Program Files (x86)\MSBuild\12.0\Bin
  </code></pre>
  
  <p>and <code>TargetFrameworkSDKToolsDirectory</code> is defined at <code>$SDK40ToolsPath</code>. According to <code>MSBuild /v:diag</code>, </p>
  
  <pre><code>SDK40ToolsPath = C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools 
  </code></pre>
  
  <p>which looks good.  The project's target in VS in .NET 4.0.</p>
  
  <p>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.</p>
  
  <pre><code>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
  </code></pre>