Giuseppe Salvatore
Giuseppe Salvatore

Reputation: 726

WindowsSDK_ExecutablePath not set correcty in VS2015 VC++ variables

I have searched a lot on the web and I couldn't find a proper solution to this, just workarounds. I wonder whether either VS2015 or WindowsSDK installation is broken.

Here is the thing: I get issue building (in link phase) and the VS environment reports can't find the Resource Compile executable (rc.exe)

TRACKER : error TRK0005: Failed to locate: "rc.exe". The system cannot find the file specified.

I searched around on my machine and found the binary in:

C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64

So the quick workaround was to add that path to PATH and everything works fine. But I am not really happy about it as I am sure the Windows SDK installer (or VS) should handle this nicely.

If I look into VS IDE -> Project -> Properties -> Configuration Properties -> VC++ Directories and look at "Executable Directories" I am expecting to find the right path in there. So I inspect it by opening MACRO (bottom right) and filtering for WindowsSDK_ExecutablePath: there I see

$(WindowsSDK_ExecutablePath) = C:\Program Files (x86)\Windows Kits\10\bin\x86 $(WindowsSDK_ExecutablePath_arm) = C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\arm $(WindowsSDK_ExecutablePath_arm64) = C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\arm64 $(WindowsSDK_ExecutablePath_x86) = C:\Program Files (x86)\Windows Kits\10\bin\x86 $(WindowsSDK_ExecutablePath_x64) = C:\Program Files (x86)\Windows Kits\10\bin\x64

As you can see the intel architecture folders point to a generic location (not SDK version specific) that of course doesn't have those binaries. Interestingly enough the ARM folders are correct.

I am trying to understand what has corrupted those folders...

I can guess it's the SDK installer as in the UAP.props file located in

$(WindowsSDKDir)/DesignTime/CommonConfiguration/Neutral/UAP/10.0.16299.0/

I can see this

<WindowsSDK_ExecutablePath_x86>$(WindowsSdkDir)bin\x86;</WindowsSDK_ExecutablePath_x86> <WindowsSDK_ExecutablePath_x64>$(WindowsSdkDir)bin\x64;</WindowsSDK_ExecutablePath_x64>

although I am not 100% sure as this is post-install so it could be VS changing that.

Any ideas? Suggestions? Anyone who had the same issue and managed to find a proper fix instead of workarounds?

Upvotes: 1

Views: 1857

Answers (1)

Giuseppe Salvatore
Giuseppe Salvatore

Reputation: 726

Right, not sure if this is the right one but digging a bit on the issue brought me at this point. What I have found is this strange block of xml code in

$(WindowsSDKDir)\DesignTime\CommonConfiguration\Neutral\UAP\10.0.16299.0\UAP.props

that looks like this:

<PropertyGroup Condition="'$(VisualStudioVersion)' != '' and '$(VisualStudioVersion)' &lt;= '14.0'">
  <WDKBinRoot>$(WindowsSdkDir)bin</WDKBinRoot>
  <WindowsSDK_ExecutablePath_x86>$(WindowsSdkDir)bin\x86;</WindowsSDK_ExecutablePath_x86>
  <WindowsSDK_ExecutablePath_x64>$(WindowsSdkDir)bin\x64;</WindowsSDK_ExecutablePath_x64>
</PropertyGroup>
<PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &gt; '14.0'">
  <WDKBinRoot>$(WindowsSdkDir)bin\10.0.16299.0</WDKBinRoot>
  <WindowsSDK_ExecutablePath_x86>$(WindowsSdkDir)bin\10.0.16299.0\x86;</WindowsSDK_ExecutablePath_x86>
  <WindowsSDK_ExecutablePath_x64>$(WindowsSdkDir)bin\10.0.16299.0\x64;</WindowsSDK_ExecutablePath_x64>
</PropertyGroup>

Correct me if I am wrong but that doesn't seem to do anything in case you have VS2015 (which is 14.0)

So I appended this after that block:

<PropertyGroup Condition="'$(VisualStudioVersion)' == '14.0'">
  <WDKBinRoot>$(WindowsSdkDir)bin\10.0.16299.0</WDKBinRoot>
  <WindowsSDK_ExecutablePath_x86>$(WindowsSdkDir)bin\10.0.16299.0\x86;</WindowsSDK_ExecutablePath_x86>
  <WindowsSDK_ExecutablePath_x64>$(WindowsSdkDir)bin\10.0.16299.0\x64;</WindowsSDK_ExecutablePath_x64>
</PropertyGroup>

With that change all works. I wonder why this file is populated this way. If you look at the end it includes arm and desktop.arm props. I also wonder if I can create a property file separate to this generic UAP.props.

Of course this fixes only this specific SDK version, you will have to do it for every version installed and, if you install a new one.

Upvotes: 1

Related Questions