15. November 2006 18:13 by Mrojas in General  //  Tags:   //   Comments (0)


Microsoft has develop the Microsoft Build Engine (MSBuild). This is the new build platform for Microsoft and Visual Studio. It is an XML configuration (very similar to other build tools like ANT) It allows to orchestrate and build products in build lab environments where Visual Studio is not installed.

It is a great aid with other tools like CruiseControl.NET, relation that I will further elaborate in other posts.

The following is very simple MSBuils script

<Project xmlns="">


<Target Name="HelloWorld">

<MakeDir Directories= "bin"/>

<Csc Sources="HellWorld.cs" TargetType="exe"

OutputAssembly=".\bin\HelloWorld.exe" />



This sample shows the basic structure of an MSBuild. This is a very basic script maybe not very useful, but general scripts will be made up of Several Targets, Properties and some dependencies between them.


To define properties just define your tags inside a <PropertyGroup> Tag. If you want for example to define an OutputPath property just do something like:


And to use it just reference it as $(OutputPath)

Groups of files

You can specify groups of files with the ItemGroup tag


<File_Image Include="$(OutputPath)\Image.jpg"/>

<cs_source Include=".\*.cs" Exclude=".\Foo1.cs" />


And you will reference them like @(File_Image) and @(cs_source).

Dependencies between Targets

<Target Name="CreateOutputPath" Condition="!Exists('$(OutputPath)')">

<MakeDir Directories= "$(OutputPath)"/>


<Target Name="FooCompilation" DependsOnTargets="CreateOutputPath"

Inputs=" Foo1.cs"