Friday, 31 October 2008

Using MSBuild in automated building and testing

MSBuild.exe command

  • Using this command we can execute some other commands (such as aspnet_merge or xcopy) or custom actions. We can pass a .proj file (a MSBuild script file) as an input argument to this command.
  • You can find it here: C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe
  • You can easily add this tool to Visual Studio; go to Tools/External Tools/Add tool

MSBuild script

MSBuild script file is an xml file with the extension of .proj in which we can define what actions we want the MSBuild.exe to execute.

Example of MSBuild script:

Using the following MSBuild script you can compile a website solution, merge the assemblies created and copy the contents of the compiled solution to a destination folder (Please remove the br elements):

Why using MSBuild?

Using MSBuild we can have automated build and testing. We can use CruiseControl.NET to listen to the events (such as a checkin or commit) happening in source controls (such as Visual SourceSafe or SubVersion), then to run a pre-defined MSBuild command. In which way, we can have automated build and testing.

Learn more:

1 comment:

Slava Imeshev said...


You might want to check out our Parabuild for Continuous Integration. Parabuild supports MSBuild out of the box, no changes to the build script required.