I'm writing a console application to get a solution from a tfs server, build it and publish on iis, but I'm stuck at building...
I found this code, which works like a charm
public static void BuildProject()
{
string solutionPath = Path.Combine(@"C:\MySolution\Common\Common.csproj");
List<ILogger> loggers = new List<ILogger>();
loggers.Add(new ConsoleLogger());
var projectCollection = new ProjectCollection();
projectCollection.RegisterLoggers(loggers);
var project = projectCollection.LoadProject(solutionPath);
try
{
project.Build();
}
finally
{
projectCollection.UnregisterAllLoggers();
}
}
but my solution it's pretty big and contains multiple projects which depends from each other (e.g. project A has a reference to project B)
how to get the correct order to build each project? is there a way to build the entire solution from the .sln file?