【问题标题】:Set Configuration when using Microsoft.Build.Evaluation.Project?使用 Microsoft.Build.Evaluation.Project 时设置配置?
【发布时间】:2015-05-18 10:02:45
【问题描述】:

我可以使用以下内容构建项目

static bool Build()
{
    var projectCollection = ProjectCollection.GlobalProjectCollection;
    var project = projectCollection.LoadProject(websiteProject);

    var fileLogger = new FileLogger();
    fileLogger.Parameters = @"logfile=" + @"app_data\log.txt";
    projectCollection.RegisterLogger(fileLogger);


    bool result = project.Build();
    projectCollection.UnregisterAllLoggers();
    return result;
}

但我需要能够将构建配置设置为发布。我看过documentation,但要么我错过了它,要么没有简单的方法来设置它。

【问题讨论】:

    标签: msbuild microsoft.build


    【解决方案1】:

    我找到了答案:

    projectCollection.SetGlobalProperty("Configuration", "Release");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-02-27
      • 2015-05-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-20
      • 2013-12-19
      相关资源
      最近更新 更多