项目文件在名为 Globals 的属性组中具有以下设置:
<PropertyGroup Label="Globals">
...
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.14393.0</WindowsTargetPlatformMinVersion>
...
</PropertyGroup>
我找不到有关如何使用 MSBuild 在命令行上设置这些内容的任何文档。
使用简单的/p
参数可以解决问题。使用如下命令:
msbuild xx.csproj/xx.sln /t:build /p:WindowsTargetPlatformVersion=xx;WindowsTargetPlatformMinVersion=xx
(应该在一行中(可以在运行时指定目标版本。
注意:要运行上述命令,应确保要在计算机中安装要指定的 Windows sdk 版本。