使用MSBuild,VS 2019,Platform Toolset v142进行编译时,如何指定“目标平台版本”和“目标平台最低版本”

时间:2019-10-19 08:08:15

标签: visual-studio msbuild windows-runtime visual-studio-2019 c++-winrt

项目文件在名为Globals的PropertyGroup中具有以下设置:

<PropertyGroup Label="Globals">
  ...
  <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
  <WindowsTargetPlatformMinVersion>10.0.14393.0</WindowsTargetPlatformMinVersion>
  ...
</PropertyGroup>

我找不到任何有关如何使用MSBuild在命令行上进行设置的文档。

1 个答案:

答案 0 :(得分:0)

使用简单的/p参数可以解决问题。使用如下命令:

msbuild xx.csproj/xx.sln /t:build /p:WindowsTargetPlatformVersion=xx;WindowsTargetPlatformMinVersion=xx(应在一行中)可以在运行时指定目标版本。

注意:要运行上述命令,您应确保将要指定的Windows sdk版本安装在计算机中。