Setting up TFS build for Sandcastle Help File Builder


In the previous post I have briefly explained how to setup SHFB project in Visual Studio. In this post I will describe the steps needed to setup TFS build that will generate documentation and drop it the output directory.

1. Download and install SHFB on your build server

Get the latest release from and install it on your build server. A reboot might be required after the installation has completed.

2. Define drop location (optional)

Edit your *.shfbproj file by adding the following:

<!-- Put this code under inside <Project><PropertyGroup>...</PropertyGroup></Project> -->
<OutDir Condition=" '$(OutDir)' == ''">.</OutDir>

This will instruct TFS to copy the SHFB’s output to the build’s drop folder.

3. Define deploy location (optional)

If after each successful build you’d like to auto-deploy the output to yet another location (other than the drop folder), you can define the following post-build task:

if NOT "$(DeployDocsTo)" == "" (
  powershell "\"$(DeployDocsTo)\" -split \";\" | foreach { Copy-Item \"$(OutputPath)\" \"$_\" -Force -Recurse }"

post build task

Now you can define MSBuild argument $(DeployDocsTo) to instruct TFS where to deploy your docs. To do so just edit your build definition as so:

tfs build

The nice thing is that when building locally with Visual Studio the post-build event will be ignored, since your $(DeployDocsTo) variable will be undefined.

This is it. Hope it helps. © 2017. All rights reserved.