locked
check in files even if build fails RRS feed

  • Question

  •  

    Dear all

    i wrote the folowing build script

    1) checks out files

    2) make the build

    3) check in the files back

    here is the code which i wrote:

    ......

    <TF>&quot;$(TeamBuildRefPath)\..\tf.exe&quot;</TF>

    </PropertyGroup>

     

    <Target Name="BeforeCompile>

    <Exec WorkingDirectory = "$(SolutionRoot)" Command = "$(TF) Checkout $(SolutionRoot)\Src\AppServer\Binaries /recursive "/>

    </Target>

     

    <Target Name = "AfterCompile">

    <Exec WorkingDirectory = "$(SolutionRoot)" Command = "$(TF) Checkin $(SolutionRoot)\Src\AppServer\Binaries /noprompt /recursive /override:&quot;Auto-Build: Version Update&quot; /comment:&quot;Auto-Build: Version Update&quot; "/>

    </Target>

    my problems are

    1) to check in files that wasnt changed

    2) how do i cause the TFSbuild even if it fails, to check in the files and not leave the dll's in the source checked out and locked??? after the build fail???

     

    and i get there no files to check in error

    Thanks alot

    Tuesday, December 26, 2006 2:50 PM

Answers

  • Based on the standard TeamBuild Targets file there are two targets designed to be overridden when a build breaks.  These targets are:

      <!-- Override this target to plugin custom tasks before handling BuildBreak target -->
      <Target Name="BeforeOnBuildBreak" />

      <!-- Override this target to plugin custom tasks after BuildBreak target -->
      <Target Name="AfterOnBuildBreak" />

    You should be able to override either of these targets and check in (or undo pending changes) on your files.

    Hope this helps.

    Wednesday, December 27, 2006 7:53 PM

All replies

  • Based on the standard TeamBuild Targets file there are two targets designed to be overridden when a build breaks.  These targets are:

      <!-- Override this target to plugin custom tasks before handling BuildBreak target -->
      <Target Name="BeforeOnBuildBreak" />

      <!-- Override this target to plugin custom tasks after BuildBreak target -->
      <Target Name="AfterOnBuildBreak" />

    You should be able to override either of these targets and check in (or undo pending changes) on your files.

    Hope this helps.

    Wednesday, December 27, 2006 7:53 PM
  • OK

    so im prity new with the teambuild

    so

    1) what is the targets file?? where can i find it?

    2) can i have sample code regarding to the code which i wrote for check in???

    thnks alot

     

    Wednesday, December 27, 2006 10:20 PM
  • Answer to 1)

    The targets file defines default tasks and targets that are included in Team Build. You can find the targets file at MSBuildExtensionsPath\Microsoft\VisualStudio\v8.0\TeamBuild\Microsoft.TeamFoundation.Build.targets. Note that this is used by all builds running on your computer.

    Swaha

    Thursday, December 28, 2006 8:47 PM
  • any answer to this phase???

    2) can i have sample code regarding to the code which i wrote for check in???

    thnks alot

     

    Friday, December 29, 2006 4:38 PM
  • For how-to extend targets with custom tasks, please refer the following:

    http://msdn2.microsoft.com/en-us/library/aa337604(VS.80).aspx

    Swaha

    Friday, December 29, 2006 5:54 PM
  • For question 2, you should be able to use your existing check-in code with a new target.  For example:

    <Target Name = "AfterOnBuildBreak">
        <Exec WorkingDirectory = "$(SolutionRoot)" Command = "$(TF) Checkin $(SolutionRoot)\Src\AppServer\Binaries /noprompt /recursive /override:&quot;Auto-Build: Version Update&quot; /comment:&quot;Auto-Build: Version Update&quot; "/>
    </Target>

    In the above example, the AfterOnBuildBreak target is overridden and will perform a check-in if the build fails.

    If you would rather "undo" pending changes of a build failure (instead of checking in) use the undo command.  For example:

    <Target Name = "AfterOnBuildBreak">
        <Exec WorkingDirectory = "$(SolutionRoot)" Command = "$(TF) Undo
             
    $(SolutionRoot)\Src\AppServer\Binaries /noprompt /recursive "/>
    </Target>

    Hope this helps.

    Wednesday, January 3, 2007 1:21 PM