1

I can build a project with the following

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;
}

But I need to be able to set the build configuration to Release. I've had a look through the documentation, but either I'm missing it or there's not an easy way to set it.

Twenty
  • 5,234
  • 4
  • 32
  • 67
Craig
  • 474
  • 7
  • 21

1 Answers1

4

I found the answer:

projectCollection.SetGlobalProperty("Configuration", "Release");
Twenty
  • 5,234
  • 4
  • 32
  • 67
Craig
  • 474
  • 7
  • 21