【问题标题】:Building C# Solution in Release mode using MSBuild.exe使用 MSBuild.exe 在发布模式下构建 C# 解决方案
【发布时间】:2014-10-19 02:26:02
【问题描述】:

我能够使用 MSBuild.exe 构建解决方案,但我的问题是我只能设法让它在 DEBUG 模式下构建。我需要使用 MSBUILD 在发布模式下构建我的解决方案。

这是我尝试过的

Process msbuild = Process.Start("C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MsBuild.exe", solutionfilepath + " /P:Config=Release");

Process msbuild = Process.Start("C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MsBuild.exe", solutionfilepath + " /P:Configuration=Release");

【问题讨论】:

  • 从命令行(而不是代码)运行 MSBuild 时,能否在发布模式下构建解决方案?

标签: c# msbuild release mode solution


【解决方案1】:
MsBuild.exe [Path to your solution(*.sln)] /t:Build /p:Configuration=Release /p:TargetFrameworkVersion=v4.0

【讨论】:

  • 为什么要指定 TargetFramework 作为参数?这应该由解决方案中的各个项目配置。
  • @Triynko 当项目在具有不同框架版本的机器中构建时有用(未安装 Visual Studio,仅 SDK),在我的情况下,v4.7 与 v4.7.2 不向后兼容。
猜你喜欢
  • 2020-02-05
  • 2011-05-12
  • 1970-01-01
  • 1970-01-01
  • 2019-01-02
  • 1970-01-01
  • 1970-01-01
  • 2010-09-22
  • 2014-02-22
相关资源
最近更新 更多