Aug 27, 2010

DefaultTargets and InitialTargets

DefaultTargets attribute is a list of targets to execute if no target is specified. The InitialTargets attribute is a list of tarets to be executed before any other targets. In the following example, the i1, i2, t1, t2 will be run in order

<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="3.5" DefaultTargets="t1;t2" InitialTargets="i1;i2" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Target Name="t1">
    <Message Text="t1 is running" />
  </Target>
  <Target Name="t2">
    <Message Text="t2 is running" />
  </Target>
  <Target Name="i1">
    <Message Text="i1 is running" />
  </Target>
  <Target Name="i2">
    <Message Text="i2 is running" />
  </Target>
</Project>