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

在vcxproj文件中:
<WindowsTargetPlatformVersion>10.0.10586.0</WindowsTargetPlatformVersion>发布于 2019-10-17 03:17:07
对于Visual Studio 2017,必须在vcxproj文件中使用特定的SDK版本号。然而,Antonio Sanchez在这篇文章的评论中有一个针对Windows10SDK的变通方法:https://developercommunity.visualstudio.com/comments/190992/view.html
<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。例如:
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>发布于 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。
https://stackoverflow.com/questions/54134339
复制相似问题