If my VB6 compilation Task fails, the WorkItem is not create

Dec 17, 2008 at 4:21 PM
If I define a task for compile an VB6 project and the compilation fails (because my source in VB contains a sintaxis error) the workitem necessary to advise me that the compilation is not generated is not created by MSB-ExtPack. This is my tfsbuild.proj:

<Project ToolsVersion="3.5" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <PropertyGroup>
    <TPath>$(MSBuildExtensionsPath)\MSBuild.ExtensionPack.tasks</TPath>
    <TPath Condition="Exists('$(MSBuildExtensionsPath)\ExtensionPack\MSBuild.ExtensionPack.tasks')">$(MSBuildExtensionsPath)\ExtensionPack\MSBuild.ExtensionPack.tasks</TPath>
  </PropertyGroup>
  <Import Project="$(TPath)"/>
  <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets"/>

  <Target Name="Default">
    <ItemGroup>
      <ProjectsToBuild Include="$(BuildDirectory)\sources\AplicacionExeSola\AplicacionExeSola.vbp">
        <outdir>$(DropLocation)\$(BuildNumber)</outdir>
      </ProjectsToBuild>
    </ItemGroup>
    <MSBuild.ExtensionPack.VisualStudio.VB6 VB6Path="C:\Archivos de programa\Microsoft Visual Studio\VB98\VB6.EXE" TaskAction="Build" Projects="@(ProjectsToBuild)"/>
  </Target>
 
  <Target Name="EndToEndIteration"
    Condition=" '$(IsDesktopBuild)'!='true' "
    DependsOnTargets="$(EndToEndIterationDependsOn)" >
    <CallTarget Targets="Default"/>
    <SetBuildProperties TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)" Status="Succeeded" />
    <OnError ExecuteTargets="OnError"/>
  </Target>
  <Target Name="OnError">
    <SetBuildProperties TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)" Status="Failed" />
  </Target>

</Project>

Editor
Jan 7, 2009 at 8:36 AM
I post this question in a msdn forums at three http://social.msdn.microsoft.com/Forums/en-US/tfsbuild/thread/2a166949-5072-4c39-96a0-2946c006c4ef and Mr Steve StJean help me with a comment that my xml script needs include on Target OnError another target like this to tell to msbuild that generate the workitem:

 <Target Name="OnError">  
     <SetBuildProperties TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)" Status="Failed" /> 
     <CallTarget Targets="CreateWorkItem"/>  
   </Target> 

this works fine and generate the workitem that I needed

Coordinator
Jan 7, 2009 at 10:06 PM
Thanks for the feedback Julio... Mike