首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Visual Studio c++项目中指定“任何Windows SDK版本高于10.0”?

如何在Visual Studio c++项目中指定“任何Windows SDK版本高于10.0”?
EN

Stack Overflow用户
提问于 2019-01-11 01:51:32
回答 2查看 4.6K关注 0票数 7

这里的开发人员安装了不同的SDK,我希望我的Visual Studio项目使用任何高于10.0的可用SDK,而不需要指定确切的SDK。有没有办法做到这一点?

在vcxproj文件中:

代码语言:javascript
复制
<WindowsTargetPlatformVersion>10.0.10586.0</WindowsTargetPlatformVersion>
EN

回答 2

Stack Overflow用户

发布于 2019-10-17 03:17:07

对于Visual Studio 2017,必须在vcxproj文件中使用特定的SDK版本号。然而,Antonio Sanchez在这篇文章的评论中有一个针对Windows10SDK的变通方法:https://developercommunity.visualstudio.com/comments/190992/view.html

代码语言:javascript
复制
<PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'==''">
    <!-- Latest Target Version property -->
    <LatestTargetPlatformVersion>
         $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))
    </LatestTargetPlatformVersion>
    <WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">
        $(LatestTargetPlatformVersion)
    </WindowsTargetPlatformVersion>
    <TargetPlatformVersion>
        $(WindowsTargetPlatformVersion)
    </TargetPlatformVersion>
</PropertyGroup>

对于Visual Studio 2019,您可以使用值10.0指定最新版本的Windows 10 SDK。例如:

代码语言:javascript
复制
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
票数 9
EN

Stack Overflow用户

发布于 2019-01-11 02:24:57

当前设计要求您的vcxproj包含特定的版本号。

既然你的项目是VS2017(基于v141平台工具集),那么就没有理由使用像15086这样老的东西了。如果有人今天安装了VS 2017的新版本(15.9更新),他们将默认安装Windows 10 SDK (10.0.17763)。他们唯一一次默认安装10.0.15806的情况是安装了VS 2017 (15.1更新),但从未更新过。

在vcxproj中坚持使用旧的Windows10SDK的唯一有意义的情况是在VS 2015项目中,因为10.0.14493是官方支持VS 2015的最后一个版本。

还要记住,对于Win32桌面应用程序,Windows10SDK (17763)仍然针对与Windows10SDK (15086)相同的版本:Windows7 SP1、Windows8.x、Windows10。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54134339

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档