Visual Studio not recognizing "BuildStep"

Posted by AmbiguousX on Stack Overflow See other posts from Stack Overflow or by AmbiguousX
Published on 2011-01-06T22:06:33Z Indexed on 2011/01/10 19:54 UTC
Read the original article Hit count: 191

I'm trying to add an automatic post-build trigger to run NDepend after an automated team build in TFS 2010.

NDepend's website provided code for integrating this capability, and so I have pasted their code into my .csproj file where they said for it to go, but I receive errors on the build.

The errors refer to two of the three "BuildStep" tags I have in the code snippet. The following two snippets are giving me errors:

<BuildStep         
    TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
    BuildUri="$(BuildUri)"
    Message="Running NDepend analysis">
  <Output TaskParameter="Id" PropertyName="StepId" />
</BuildStep>

and

<BuildStep
   TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
   BuildUri="$(BuildUri)"
   Id="$(StepId)"
   Status="Failed" />

However, this code snippet is NOT throwing up any problems:

<BuildStep
   TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
   BuildUri="$(BuildUri)"
   Id="$(StepId)"
   Status="Succeeded" />

I just don't understand why one works fine and a nearly identically laid out BuildStep tag does not. Is there something simple that I'm just overlooking?

EDIT: Here is how it looks all together, if this makes a difference:

  <Target Name="NDepend"  >
    <PropertyGroup>
      <NDPath>c:\tools\NDepend\NDepend.console.exe</NDPath>
      <NDProject>$(SolutionDir)MyProject.ndproj</NDProject>
      <NDOut>$(TargetDir)NDepend</NDOut>
      <NDIn>$(TargetDir)</NDIn>
    </PropertyGroup>
    <Exec
      Command='"$(NDPath)" "$(NDProject)" /OutDir "$(NDOut)" /InDirs "$(NDIn)"'/>
  </Target>
  <Target Name="AfterBuild">
    <BuildStep         TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
        BuildUri="$(BuildUri)"
        Message="Running NDepend analysis">
      <Output TaskParameter="Id" PropertyName="StepId" />
    </BuildStep>
    <PropertyGroup>
      <NDPath>c:\tools\NDepend\NDepend.console.exe</NDPath>
      <NDProject>$(SolutionRoot)\Main\src\MyProject.ndproj</NDProject>
      <NDOut>$(BinariesRoot)\NDepend</NDOut>
      <NDIn>$(BinariesRoot)\Release</NDIn>
    </PropertyGroup>
    <Exec
      Command='$(NDPath) "$(NDProject)" /OutDir "$(NDOut)" /InDirs "$(NDIn)"'/>
    <BuildStep
        TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
        BuildUri="$(BuildUri)"
        Id="$(StepId)"
        Status="Succeeded" />
    <OnError ExecuteTargets="MarkBuildStepAsFailed" />
  </Target>

  <Target Name="MarkBuildStepAsFailed">
    <BuildStep
        TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
        BuildUri="$(BuildUri)"
        Id="$(StepId)"
        Status="Failed" />
  </Target>

EDIT: Added a bounty because I really need to get this going for my team.

Thank you in advance!

© Stack Overflow or respective owner

Related posts about Xml

Related posts about tfs