How does MSBuild build a solution?

MSBuild only builds Xml files that follow the MSBuild standards.

However, there is a special case for solutions, because you can just build solutions using MSBuild, although this is not an MSBuild format.

MSBuild supports this by first generating an in-memory MSBuild file (called a traversal project) that will build all projects included in the solution.

Sometimes, it is useful to know how this internal traversal project looks. There is a way to make MSBuild save this file. This is done by setting an enviroment variable:

set MSBuildEmitSolution=1

When you run MSBuild this will create an additional project file in the current directory with this traversal project, so you can see how things are done. For instance, when you are using web projects, you will see the magic that calls the ASP.NET compiler 🙂