无法在Visual Studio C ++项目中更改Windows SDK版本 [英] Can't change Windows SDK version in Visual Studio C++ project

查看:1123
本文介绍了无法在Visual Studio C ++项目中更改Windows SDK版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Visual Studio 2015创建的Visual Studio C ++控制台应用程序,现在(由于使用了未安装的Windows 8.1 SDK)我无法编译(使用Visual Studio 2017).问题是我无法将项目重新定位到Windows 10 SDK.

I have a Visual Studio C++ console application that I created with Visual Studio 2015 and now I can't compile it (with Visual Studio 2017) because it is targeting the Windows 8.1 SDK, which is not installed. The problem is that I can't retarget the project to the Windows 10 SDK.

发生的事情是,当我打开项目属性页面并转到 General-Target Platform 时,我在下拉列表中看到Windows 10 SDK,并且可以选择它...但是按下 Apply (应用)后,它会自动恢复为8.1 .没有提供错误消息.

What happens is that when I open the project properties page and go to General - Target Platform I see the Windows 10 SDK in the dropdown, and I am able to select it... but as soon as I press Apply, it reverts back to 8.1 by itself. No error message is provided.

Visual Studio安装程序说确实已经安装了列出的SDK版本:

Visual Studio installer says that, indeed, the listed SDK version is installed:

那么这是怎么回事?有没有一种方法可以重新定向我的项目而无需安装Windows 8.1 SDK?

So what's going on here? Is there a way to retarget my project without having to install the Windows 8.1 SDK?

不知道这是否重要,但是:该项目实际上只是一个现有的裸项目的包装器",该裸项目仅由一堆由另一个人开发的.cpp和.h文件组成.我真的不熟悉C ++开发.

推荐答案

经过数小时的努力,我偶然发现选择项目属性/常规,将平台工具集"更改为v141_xp (而不是v141)强制将Windows SDK版本降至8.1或7.0.我不确定Visual Studio如何选择要使用的SDK.

After hours of struggling with this problem, I coincidentally discovered that selecting Project Properties/General, changing "Platform Toolset" to v141_xp (instead of v141) forcibly drops the Windows SDK Version to 8.1 or 7.0. I'm not sure how Visual Studio chooses which SDK to use.

您必须编辑.vcxproj并同时更改两者:

You must edit .vcxproj and change both:

<TargetPlatformVersion>10.0.17134.0</TargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>

这篇关于无法在Visual Studio C ++项目中更改Windows SDK版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆