Project files have these settings in a PropertyGroup named Globals:
<PropertyGroup Label="Globals">
...
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.14393.0</WindowsTargetPlatformMinVersion>
...
</PropertyGroup>
I wasn't able to find any documentation about how to set these on the command line with MSBuild.
Using the simple /p
argument can do the trick. Using command like:
msbuild xx.csproj/xx.sln /t:build /p:WindowsTargetPlatformVersion=xx;WindowsTargetPlatformMinVersion=xx
(should be in one line) can specify the target version in runtime.
Note: To run commands above, you should make sure the windows sdk version you wanna specify is installed in your machine.