How to build a project using c#?
Here is the code
public void BuildProject(string BuildUri)
{
List<ILogger> loggers = new List<ILogger>();
loggers.Add(new ConsoleLogger());
var projectCollection = new Microsoft.Build.Evaluation.ProjectCollection();
projectCollection.RegisterLoggers(loggers);
var project = projectCollection.LoadProject(BuildUri); // Needs a reference to System.Xml
try
{
project.Build();
}
finally
{
projectCollection.UnregisterAllLoggers();
}
}
No comments:
Post a Comment