MSBuild:在BuildEngine中定义子项目的构建配置 [英] MSBuild: define subprojects build configuration in BuildEngine

查看:110
本文介绍了MSBuild:在BuildEngine中定义子项目的构建配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用BuildEngine作为创建一键式构建环境的步骤.代码如下:

I'm using BuildEngine as a step to create a one click build environment. The code is the following:

Engine engine = new Engine();
FileLogger logger = new FileLogger { Parameters = @"logfile=C:\builds\build.log" };
engine.RegisterLogger(logger);

var project = new Project(engine);
project.Load("Example.csproj");
project.SetProperty("Configuration", "Release");

bool success = project.Build();

他似乎使用发布配置来构建项目示例.但是当我查看build.log时,Example项目的所有依赖项都是作为调试生成的.

And he seems to build project Example with release configuration. But when I look at the build.log, all of the dependencies of Example project were build as debug.

有没有办法强迫它建立对Release的所有依赖关系?

Is there any way to force it to build all dependencies on Release?

推荐答案

在引擎上设置全局属性:

Set the global properties on the engine:

BuildPropertyGroup bpg = new BuildPropertyGroup ();
bpg.SetProperty ("Configuration", "Release");
engine.GlobalProperties = bpg;

这些将覆盖项目本身设置的属性.

These will override the properties set by the project themselves.

这篇关于MSBuild:在BuildEngine中定义子项目的构建配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆