Visual Studio 2017 Support Notes

This topic describes XDK support for Visual Studio 2017. The RTM version of Visual Studio 2017 and the latest update (version 15.9) are supported for XDK development.

Note If you install a new edition of Visual Studio 2017 after installing the May 2018 XDK or newer, you need to repair the XDK or manually install the two .vsix files located at c:\Program Files (x86)\Microsoft Durango XDK\<edition>\XDK\VS2017 in order for the XDK to integrate with the newly installed edition of Visual Studio 2017.
Note If you install the May 2018 or later XDK side-by-side with earlier XDK edition(s) and then uninstall all of the May 2018 or later editions you will need to uninstall and re-install the older XDK(s) to restore Visual Studio 2017 XDK support. A repair is not sufficient to fix this issue.

Visual Studio 2017 Support Notes

When installing VS 2017, you will need to select a few optional components in setup:

  1. Select the “Game Development with C++” workload.
  2. Select the “Windows 8.1 SDK and UCRT SDK” optional component in this workload
  3. Select the “Universal Windows Platform development” workload

Migrating existing Visual Studio 2015 projects to Visual Studio 2017

In most cases, the upgrade wizard provided with Visual Studio can migrate your project to Visual Studio 2017 without any other changes. When you open a Visual Studio 2015 project in Visual Studio 2017 you’ll see the following dialog prompting you to upgrade:

Selecting OK will cause the project to be upgraded.

Manually upgrading projects to Visual Studio 2017

If you want to upgrade your project by directly editing your project files (.vcxproj) you’ll need to make the following changes:

<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  
 <PlatformToolset>v140</PlatformToolset>
 <PlatformToolset>v141</PlatformToolset>  

Additional Visual Studio 2017 migration resources

Referencing CRT headers and libraries from Visual Studio 2017 projects

As of QFE1 of the July 2018, the XDK includes CRT headers and libraries that match the compiler and linker toolset shipped in version 15.8 of Visual Studio 2017. The CRT headers and libraries that shipped in XDKs prior to February 2018 are still included for backwards compatibility and for use with some of the previous versions of Visual Studio.

The new and old headers and libraries are installed side-by-side under the %DurangoXDK"edition number”\xdk directory. The new headers are in a folder named VS2017 while the older headers are in the VS2015 folder.

By default, all projects that are built with Visual Studio 2017 will build with the headers and libraries in the VS2017 directory. If you are not using version 15.5 or later of Visual Studio 2017 (or 15.8 or later if using C++17) there may be cases where you’ll need to fall back to using the old headers instead. An msbuild property called EnableLegacyXdkHeaders can be used to fall back to the previous versions of the CRT headers and libraries contained in the VS2015 directory.

The following table provides guidance on which version of the CRT headers and libraries to reference based on the version of compiler you are using:

Visual Studio versionCRT guidance
VS 2017 (15.0 a.k.a. RTM)

VS 2017 (15.1)

VS 2017 (15.2)

_MSC_VER "1910"

The VS 2017 CRT headers in the Xbox One XDK (February 2018 or later) are not compatible with the original VS 2017 compiler present in 15.0, 15.1, and 15.2.

It is recommended that you update to a newer version of VS 2017.

Alternatively, you can EnableLegacyXdkHeaders to use the VS 2015 C/C++ Runtime headers.

via Environment Variable

set EnableLegacyXdkHeaders=true

or VC++ Project element

<PropertyGroup Label="Globals">

...

<EnableLegacyXdkHeaders>true<EnableLegacyXdkHeaders>

<PropertyGroup>

VS 2017 (15.3)

VS 2017 (15.4)

_MSC_VER "1911"

To support this scenario with the April 2018 XDK or newer, you need to define a processor symbol: /D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH.

With /std:c++17 or /std:c++latest, use /D_HAS_ALIGNED_NEW=0

You may have to suppress some C4996 warnings with

/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING

/D_SILENCE_CXX17_RAW_STORAGE_ITERATOR_DEPRECATION_WARNING

/D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING

Alternatively, you can EnableLegacyXdkHeaders to use the VS 2015 C/C++ Runtime headers.

Use of /permissive- in this case is not recommended.

VS 2017 (15.5)

_MSC_VER "1912"

The CRT headers in February 2018 Xbox One XDK match this update.

You can EnableLegacyXdkHeaders to use the VS 2015 C/C++ Runtime headers, but will likely need to apply the following workarounds:

(A) unresolved external symbol __libm_sse2_sincosf_

  • compiler flag: /d2Qvec-mathlib-
  • linker flag (LTCG/WPO): /d2:"-Qvec-mathlib-"

(B) (C++17 mode only) unresolved external symbol void __cdecl operator delete(void *,unsigned __int64,enum std::align_val_t)

  • compiler flag: /Zc:alignedNew-
VS 2017 (15.6)

_MSC_VER "1913"

Xbox One XDK (April 2018 or newer) version of the C/C++ Runtime matches this update.

You can EnableLegacyXdkHeaders to use the VS 2015 C/C++ Runtime headers, but will likely need to apply the following workarounds:

(C) unresolved external symbol __libm_sse2_sincosf_

  • compiler flag: /d2Qvec-mathlib-
  • linker flag (LTCG/WPO): /d2:"-Qvec-mathlib-"

(B) (C++17 mode only) unresolved external symbol void __cdecl operator delete(void *,unsigned __int64,enum std::align_val_t)

  • compiler flag: /Zc:alignedNew-
VS 2017 (15.7)

_MSC_VER “1914”

The Xbox One XDK (May 2018, June 2018, or July 2018) version of the C/C++ Runtime matches this update.

You can EnableLegacyXdkHeaders to use the VS 2015 C/C++ Runtime headers, but will likely need to apply the following workarounds:

(A) unresolved external symbol __libm_sse2_sincosf_

  • compiler flag: /d2Qvec-mathlib-
  • linker flag (LTCG/WPO): /d2:"-Qvec-mathlib-"

(B) (C++17 mode only) unresolved external symbol void __cdecl operator delete(void *,unsigned __int64,enum std::align_val_t)

  • compiler flag: /Zc:alignedNew-
VS 2017 (15.8)

_MSC_VER “1915”

The Xbox One XDK (July 2018 QFE1+) version of the C/C++ Runtime matches this update.

With older versions of the CRT, you will need to apply the following workaround to your Debug configuration:

(A) unresolved external symbol __CheckForDebuggerJustMyCode

  • General -> C/C++ -> set “Support Just My Code Debugging” set “No”
  • compiler flag: remove /JMC from the command-line or explicitly use /JMC-

You can EnableLegacyXdkHeaders to use the VS 2015 C/C++ Runtime headers, but will likely need to apply the following workarounds:

(B) unresolved external symbol __libm_sse2_sincosf_

  • compiler flag: /d2Qvec-mathlib-
  • linker flag (LTCG/WPO): /d2:"-Qvec-mathlib-"

(C) (C++17 mode only) unresolved external symbol void __cdecl operator delete(void *,unsigned __int64,enum std::align_val_t)

  • compiler flag: /Zc:alignedNew-
VS 2017 (15.9)

_MSC_VER “1916”

A future Xbox One XDK version of the C/C++ Runtime will match this update. This compiler is fully compatible with the 15.8 update C/C++ Runtime in the Xbox One XDK (July 2018 QFE1+).

With older versions of the CRT, you will need to apply the following workaround to your Debug configuration:

(A) unresolved external symbol __CheckForDebuggerJustMyCode

  • General -> C/C++ -> set “Support Just My Code Debugging” set “No”
  • compiler flag: remove /JMC from the command-line or explicitly use /JMC-

You can EnableLegacyXdkHeaders to use the VS 2015 C/C++ Runtime headers, but will likely need to apply the following workarounds:

(B) unresolved external symbol __libm_sse2_sincosf_

  • compiler flag: /d2Qvec-mathlib-
  • linker flag (LTCG/WPO): /d2:"-Qvec-mathlib-"

(C) (C++17 mode only) unresolved external symbol void __cdecl operator delete(void *,unsigned __int64,enum std::align_val_t)

  • compiler flag: /Zc:alignedNew-

If you’re not using msbuild, you can control which version of the CRT you compile and link with using your include and lib paths:

Path Visual Studio 2015 CRT Visual Studio 2017 CRT
Include %Console_SdkRoot%\VS2015\vc\include

%Console_SdkRoot%\VS2015\vc\platform\amd64

%Console_SdkRoot%\VS2017\vc\include

%Console_SdkRoot%\VS2017\vc\platform\amd64

Library Reference

Library WinRT

%Console_SdkRoot%\VS2015\vc\lib\amd64

%Console_SdkRoot%\VS2015\vc\platform\amd64

%Console_SdkRoot%\VS2017\vc\lib\amd64

%Console_SdkRoot%\VS2017\vc\platform\amd64

Exception Specifiers

C++11 introduced a new, streamlined method of annotating exception-throwing behavior of functions first supported by VS 2015. At the same time, older exception specifiers were deprecated and removed as of C++17. See Microsoft documentation for details.

To support this change, there’s been a number of modifications to the C++ compiler over the update cycle for VS 2017 as detailed here.

#ifndef _NOEXCEPT
#define _NOEXCEPT noexcept
#endif

Note C++ destructors are implicitly noexcept. Also, the C++ Core Guidelines recommend using the noexcept keyword for all default constructors, move constructors, move operators, and swap functions.