使用 MSBuild、VS 2019、Platform Toolset v142 编译时如何指定 "Target Platform Version" 和 "Target Platform Min. Version"
How can I specify "Target Platform Version" and "Target Platform Min. Version" when compiling with MSBuild, VS 2019, Platform Toolset v142
项目文件在名为 Globals 的 PropertyGroup 中具有这些设置:
<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版本安装在你的机器上。
项目文件在名为 Globals 的 PropertyGroup 中具有这些设置:
<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版本安装在你的机器上。