I wasted a few hours on this, and thought I’d mention it and maybe save
somebody else from doing the same…
Installing WDK 10 results in invalid INCLUDE and LIB environment variables in
VS command prompt windows (e.g. “VS2015 x64 Native Tools Command Prompt”).
Microsoft is aware of the problem (see link to Connect issue below).
The VS command prompt runs “%VSInstallDir%\VC\vcvarsall.bat”, which eventually
calls “%VS140COMNTOOLS%\vcvarsqueryregistry.bat”.
vcvarsqueryregistry.bat tries to find the Windows SDK version by enumerating
the subdirectories under “%ProgramFiles(x86)%\Windows Kits\10\include”. It
expects all the directory names to be version numbers (e.g. 10.0.10240.0), and
the last one in sorted order will be the “latest”. The “wdf” subdirectory
created by WDK 10 breaks this.
The WindowsSDKVersion, WindowsSDKLibVersion, and UCRTVersion environment
variables end up set to “wdf”, which causes the INCLUDE and LIB variables to
be set incorrectly.
msbuild still works, because it ignores the environment by default (just don’t
set UseEnv to true!). However, the C/C++ compiler and linker will fail if run
by any other build system (e.g. make, gyp, ninja, etc.).
I worked around the problem by hacking vcvarsqueryregistry.bat to hard code
the SDK version (diff is attached below, but may be mangled by EMAIL
processing). Hopefully Microsoft will fix this in VS2015 Update 1.
References:
https://connect.microsoft.com/VisualStudio/feedback/details/1610302/
https://connect.microsoft.com/VisualStudio/Feedback/Details/1656623/
http://stackoverflow.com/questions/31862627/
Temporary fix:
— vcvarsqueryregistry.bat.ORIGINAL Thu Jun 25 23:00:18 2015
+++ vcvarsqueryregistry.bat Fri Sep 25 12:15:58 2015
@@ -49,7 +49,7 @@
)
)
@REM Get windows 10 sdk version number
-@if not “%WindowsSdkDir%”==“” @FOR /F “delims=” %%i IN (‘dir
"%WindowsSdkDir%include" /b /ad-h /on’) DO @set WindowsSDKVersion=%%i\
+@if not “%WindowsSdkDir%”==“” @set WindowsSDKVersion=10.0.10240.0\
@if not “%WindowsSDKVersion%”==“” @SET WindowsSDKLibVersion=%WindowsSDKVersion%
@if not “%WindowsSdkDir%”==“” @set
WindowsLibPath=%WindowsSdkDir%UnionMetadata;%WindowsSdkDir%References;%WindowsSdkDir%References\Windows.Foundation.UniversalApiContract\1.0.0.0;%WindowsSdkDir%References\Windows.Foundation.FoundationContract\1.0.0.0;%WindowsSdkDir%References\indows.Networking.Connectivity.WwanContract\1.0.0.0
@@ -71,7 +71,7 @@
)
)
@REM get windows 10 sdk version number
-@if not “%WindowsSdkDir%”==“” @FOR /F “delims=” %%i IN (‘dir
"%WindowsSdkDir%include" /b /ad-h /on’) DO @SET WindowsSDKVersion=%%i\
+@if not “%WindowsSdkDir%”==“” @set WindowsSDKVersion=10.0.10240.0\
@if not “%WindowsSDKVersion%”==“” @SET WindowsSDKLibVersion=%WindowsSDKVersion%
@if not “%WindowsSdkDir%”==“” @set
WindowsLibPath=%WindowsSdkDir%UnionMetadata;%WindowsSdkDir%References;%WindowsSdkDir%References\Windows.Foundation.UniversalApiContract\1.0.0.0;%WindowsSdkDir%References\Windows.Foundation.FoundationContract\1.0.0.0;%WindowsSdkDir%References\indows.Networking.Connectivity.WwanContract\1.0.0.0
@@ -289,7 +289,7 @@
)
)
@if “%UniversalCRTSdkDir%”==“” exit /B 1
xxxxx@FOR /F “delims=” %%i IN (‘dir "%UniversalCRTSdkDir%include" /b /ad-h /on’)
DO @SET UCRTVersion=%%i
+@SET UCRTVersion=10.0.10240.0
@exit /B 0
:GetUniversalCRTSdkDirHelper64
@@ -299,7 +299,7 @@
)
)
@if “%UniversalCRTSdkDir%”==“” exit /B 1
xxxxx@FOR /F “delims=” %%i IN (‘dir "%UniversalCRTSdkDir%include" /b /ad-h /on’)
DO @SET UCRTVersion=%%i
+@SET UCRTVersion=10.0.10240.0
@exit /B 0
@REM -----------------------------------------------------------------------