How to build against windows 8.1 SDK

My setup is this:

Windows 8.1, Microsoft Visual Studio 2012

I want to build against the Windows 8.1 SDK. My application is C ++, there are no Windows environment components or something like that.

I have the Windows 8.1 SDK installed, but Visual Studio works against the Windows 7 SDK, so to switch goals, I change the registry keys that point to the current version of the SDK:

HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Microsoft SDK \ Windows Registry

However, when I check macros in Visual Studio, it now builds against the Windows SDK 8.0 instead of 8.1.

Visual studio macros

Can anyone explain why this is happening? I could not build against the Windows 8.1 SDK with my setup, is it just impossible to use Visual Studio 2012? I cannot find the final information to tell me whether it is supported or not.

+6
source share
1 answer

What's happening

WindowsSdkDir is an internal Visual Studio variable that is derived from registry keys based on the Platform Toolet project property (in the "Configuration Properties / General" section). For Visual Studio 2012 Toolkit (v110), a registry key, for example:

 HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0 HKCU\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0 HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.0 HKCU\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.0 

regardless of the keys CurrentVersion and CurrentInstallFolder .

How to build with the Windows 8.1 SDK with Visual Studio 2012

As described in this blog post :

VS 2010/2012 users: You can use the property technique for the Windows 8.1 SDK described in this Visual C ++ Team Blog Post originally for the VS 2010 + Windows 8.0 SDK. For VS 2010, just change part of the paths from "8.0" / "win8" to "8.1" / "winv6.3", but otherwise use all of these instructions. For VS 2012, you can simplify all paths by simply adding 8.1 paths to the existing value for each variable. Updated .props are attached to this blog post. This should only be used for developing Win32 desktop applications.

After making these changes, you should get a properties sheet (which is also provided as an attachment to the same blog ), which for x86 looks like:

 <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ImportGroup Label="PropertySheets" /> <PropertyGroup Label="UserMacros" /> <PropertyGroup> <ExecutablePath>$(ProgramFiles)\Windows Kits\8.1\bin\x86;$(ExecutablePath)</ExecutablePath> <IncludePath>$(ProgramFiles)\Windows Kits\8.1\Include\um;$(ProgramFiles)\Windows Kits\8.1\Include\shared;$(ProgramFiles)\Windows Kits\8.1\Include\winrt;$(IncludePath)</IncludePath> <LibraryPath>$(ProgramFiles)\Windows Kits\8.1\lib\winv6.3\um\x86;$(LibraryPath)</LibraryPath> <ExcludePath>$(ProgramFiles)\Windows Kits\8.1\Include\um;$(ProgramFiles)\Windows Kits\8.1\Include\shared;$(ProgramFiles)\Windows Kits\8.1\Include\winrt;$(ExcludePath)</ExcludePath> </PropertyGroup> <ItemDefinitionGroup /> </Project> 

And similarly for x64:

 <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ImportGroup Label="PropertySheets" /> <PropertyGroup Label="UserMacros" /> <PropertyGroup> <ExecutablePath>$(ProgramFiles)\Windows Kits\8.1\bin\x64;$(ExecutablePath)</ExecutablePath> <IncludePath>$(ProgramFiles)\Windows Kits\8.1\Include\um;$(ProgramFiles)\Windows Kits\8.1\Include\shared;$(ProgramFiles)\Windows Kits\8.1\Include\winrt;$(IncludePath)</IncludePath> <LibraryPath>$(ProgramFiles)\Windows Kits\8.1\lib\winv6.3\um\x64;$(LibraryPath)</LibraryPath> <ExcludePath>$(ProgramFiles)\Windows Kits\8.1\Include\um;$(ProgramFiles)\Windows Kits\8.1\Include\shared;$(ProgramFiles)\Windows Kits\8.1\Include\winrt;$(ExcludePath)</ExcludePath> </PropertyGroup> <ItemDefinitionGroup /> </Project> 

A word of caution. Although this would determine all the paths needed to build against the Windows 8.1 SDK, it does not modify WindowSdkDir and related macros that still point to the Windows 8.0 SDK. This can potentially lead to build inconsistencies if you use these macros to determine project properties.

Finally, note that Visual Studio 2013 ships with the Windows 8.1 SDK, and therefore it is an SDK used with the standard tooling feature of the Visual Studio 2013 platform (v120). Therefore, if upgrading to VS2013 is an option, this can save you some trouble.

+6
source

Source: https://habr.com/ru/post/983336/


All Articles