Posts tagged ‘MSBuild’

MSBuild and dogfood

MSBuild is Microsoft’s answer to NAnt. That is, it is an XML scripting language that supports the automation of compilation of .NET solutions.

The theory is, MSBuild is what Visual Studio uses internally to compile solutions, so it should be exactly equivalent to calling MSBuild from a build-server. We are led to believe that Microsoft has “eaten their dogfood” with regard to MSBuild.

The reality is, that is hogwash! If you have Visual Studio 2005, take a look at the MSBuild command line that appears in the output window when you compile a project. It specifies the name of every file in the project. In other words, Visual Studio independently parses the project (which it should not do because that is MSBuild’s job), and then calls MSBuild with a highly customized set of parameters that has no doubt been well tested to work in a variety of scenarios.

The point being, it is not feasible to duplicate that command line on a build server. The result is some non-trivial level of frustration! I am sure there are more, but the things I have noticed are:

  • MSBuild requires references to projects that Visual Studio does not. Thus, what compiles in Visual Studio will not necessarily compile on the build server
  • MSBuild manages project dependencies in a different way than Visual Studio. The result is that it is possible for a full rebuild on the build machine to silently FAIL to build one of the projects.

Aaargh!