使用 MSBuid 命令编译项目

MSBuild MyApp.sln /t:Rebuild /p:Configuration=Release

// 使用特定的 sdk 版本和生成工具
MSBuild tightvnc2015.sln /t:rebuild /p:Configuration=Release;TargetPlatformVersion=10.0.17134.0;PlatformToolset=v142;Platform=x64 -m

MSBuild MyApp.csproj /t:Clean
                     /p:Configuration=Debug;/p:Platform=x86;TargetFrameworkVersion=v3.5

-p 指定属性,属性可从 https://docs.microsoft.com/zh-cn/visualstudio/msbuild/common-msbuild-project-properties?view=vs-2019 获得

文档上忽略了以下属性

  • TargetPlatformVersion
    • sdk的版本:Windows 10 SDK (10.0.17134.0),如果是从命令行选择,那么需要填写完整的版本号,如:10.0.17134.0
    • 如果是修改文件:<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> 填写 10 就行
  • PlatformToolset
    • 生成工具版本:MSVC v142 - VS 2019 C++ x64/86 生成工具(v14.23)
    • 填写 v142 即可,对于 xp 系统有特殊的值:v140_xp
发布了36 篇原创文章 · 获赞 1 · 访问量 8968

猜你喜欢

转载自blog.csdn.net/u011091701/article/details/104360296