C++ 如何安装 Windows 10 SDK 以与 Visual Studio 2017 一起使用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/50590700/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 15:45:50  来源:igfitidea点击:

How do I install Windows 10 SDK for use with Visual Studio 2017

c++visual-studio-2017windows-10directx

提问by Mich

I can't figure out how to install Windows 10 SDK for Visual Studio 2017.

我不知道如何为 Visual Studio 2017 安装 Windows 10 SDK。

I downloaded and ran the Windows 10 SDK installer, and it displays Please find winsdksetup.exe in ....\Windows kits\10\WindowsSDK to install Windows Software Development Kit - Windows 10.0.17134.12.

我下载并运行了 Windows 10 SDK 安装程序,它显示 Please find winsdksetup.exe in ....\Windows kits\10\WindowsSDK to install Windows Software Development Kit - Windows 10.0.17134.12.

When I run winsdksetup.exe, it takes me through the same loop, where it downloads a bunch of executable installers into this directory and show the same exact message.

当我运行时winsdksetup.exe,它会带我通过相同的循环,它将一堆可执行安装程序下载到此目录中并显示完全相同的消息。

When I try to build a DirectX project in VS2017, I get the error:

当我尝试在 VS2017 中构建 DirectX 项目时,出现错误:

MSB8036 The Windows SDK version 10.0.16299.0 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution".    

Do I need to install one of those installers? Which one do I need to run to build and debug DirectX projects for Visual Studio? Specifically to use VS2017 shader debugging functionality.

我需要安装这些安装程序之一吗?我需要运行哪一个来为 Visual Studio 构建和调试 DirectX 项目?专门用于使用 VS2017 着色器调试功能。

Thanks,

谢谢,

EDIT: Under VS2017 - Tools -> Get Tools and Features I have checked

编辑:在 VS2017 下 - 工具 -> 获取我检查过的工具和功能

Game Development with C++

使用 C++ 进行游戏开发

and under Optional I have

在 Optional 我有

C++ Profiling tools Windows 10 SDK (10.0.17134.0)

C++ 分析工具 Windows 10 SDK (10.0.17134.0)

I'm downloading 16299.0, this fixed the first error of not having the right SDK.

我正在下载 16299.0,这修复了没有正确 SDK 的第一个错误。

But now I get the runtime error Failed Creating the Direct3D devicewhen running in Debug. I can still run samples in Release

但是现在Failed Creating the Direct3D device在 Debug 中运行时出现运行时错误。我仍然可以在 Release 中运行示例

回答by magicandre1981

The error message shows which SDK you need:

错误消息显示您需要哪个 SDK:

The Windows SDK version 10.0.16299.0 was not found

未找到 Windows SDK 版本 10.0.16299.0

So the SDK for Windows 10 Fall Creators Update 1709 is missing and you downloaded the SDK for April 2018 Update (1803 Build 17134).

因此,缺少适用于 Windows 10 Fall Creators Update 1709 的 SDK,您下载了适用于 2018 年 4 月更新(1803 Build 17134)的 SDK。

Run Visual Studio 2017 installer (C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe), click on modify, and select 16299 SDK under SDK/framework in individual components tab of the installer:

运行 Visual Studio 2017 安装程序 ( C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe),单击 ,然后在modify安装程序的各个组件选项卡中的 SDK/framework 下选择 16299 SDK:

enter image description here

在此处输入图片说明