You can do that by providing the following config entry in the MS Build or TFS Build config file,
<GetBuildProperties TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
                        BuildUri="$(BuildUri)"
                        Condition=" '$(IsDesktopBuild)' != 'true' ">
      <Output TaskParameter="CompilationSuccess" PropertyName="LocalCompilationSuccess" />
     </GetBuildProperties>
   
 
<Exec Condition="'$(LocalCompilationSuccess)'=='true'" Command="do_the_voodoo"/>
www.codecollege.NET