Getting my Sandcastle Team Build targets file to work with Sandcastle September CTP


A few things before we get started:



  1. You will need the HTML Help Workshop installed

  2. September CTP of Sandcastle

  3. My September CTP Sandcastle Targets File (attached)
    This file needs to be copied to your %programfiles%\MSBuild directory

Next you will need to make some modifications to the standard configuration file (I am using the VS2005 style)



  1. Make a copy of %programfiles%\Sandcastle\Presentation\vs2005\configuration\sandcastle.config


  2. Change references of


    1. ..\..\ to %programfiles%\sandcastle\

    2. ..\cpref_reflection to %programfiles%\sandcastle\examples\cpref_reflection

Update your TFSBuild.proj to include the following:



  1. Add a new Import tag referencing the sandcastle targets file


  2. Add a new target called DocumentCLR
    <Target Name=”DocumentCLR”>
    <CallTarget Targets=”SandcastleDocument” ContinueOnError=”false” />
    <MakeDir Condition=”!Exists(‘$(BinariesRoot)\Documentation’)” Directories=”$(BinariesRoot)\Documentation” ContinueOnError=”false” />
    <Copy SourceFiles=”$(SandcastleWorkingDirectory)\Output\$(SandcastleDocumentationName).chm” DestinationFiles=”$(BinariesRoot)\Documentation\$(SandcastleDocumentationName).chm” ContinueOnError=”false”/>
    </Target>

  3. Add an additional target that overrides the AfterCompile target
    <Target Name=”AfterCompile”>
    <CallTarget RunEachTargetSeparately=”true” Targets=”DocumentCLR” ContinueOnError=”false”/>
    <OnError ExecuteTargets=” OnBuildBreak;”/>
    </Target>

  4. Update your TFSBuild.rsp file to include some configuration
    /p:SandcastleDocumentationName=NameOfYourCHM
    /p:SandcastleConfiguration=”C:\Path_TO_MODIFIED_CONFIG\sandcastle.config”
    /p:SandcastleDocumentationOutput=$(BinariesRoot)\Documentation
    /p:SandcastleDependencies=”%windir%\Microsoft.NET\Framework\v2.0.50727\*.dll,\\lcabuildvm01\3rdParty\Dependencies\*.dll,%windir%\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.UnitTestFramework\8.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll”
    /p:SandcastleHelpGeneration=CHM

Sandcastle.targets

Comments (2)

  1. JoeGeeky says:

    This is great, I have been looking for something like this, although when I follow the instruction I get an error.  Is there a work around?

    Target AfterCompile:

       Target DocumentCLR:

           Target SandcastleDocument:

               mrefbuilder.exe C:ISourceMDASTeamBuildsSmelser.NETHello World Team BuildBuildType..Sources..Binariesx86Debug*.dll /out:C:DOCUME~1SVCSTF~1LOCALS~1TempSmelser.NET_Hello World Team Buildreflection.org /dep:C:WINDOWSMicrosoft.NETFrameworkv2.0.50727*.dll,C:WINDOWSassemblyGAC_MSILMicrosoft.VisualStudio.QualityTools.UnitTestFramework8.0.0.0__b03f5f7f11d50a3aMicrosoft.VisualStudio.QualityTools.UnitTestFramework.dll

               MrefBuilder (v2.2.61208.1447)

               Copyright c Microsoft 2006

               Error: An error occured while loading assemblies for reflection. The error message is: Could not find a part of the path ‘C:Program FilesSandcastleProductionToolsBuildBinariesx86Debug’.

               C:Program FilesMSBuildSandcastle.targets.xml(30,5): error MSB3073: The command "mrefbuilder.exe C:ISourceMDASTeamBuildsSmelser.NETHello World Team BuildBuildType..Sources..Binariesx86Debug*.dll /out:C:DOCUME~1SVCSTF~1LOCALS~1TempSmelser.NET_Hello World Team Buildreflection.org /dep:C:WINDOWSMicrosoft.NETFrameworkv2.0.50727*.dll,C:WINDOWSassemblyGAC_MSILMicrosoft.VisualStudio.QualityTools.UnitTestFramework8.0.0.0__b03f5f7f11d50a3aMicrosoft.VisualStudio.QualityTools.UnitTestFramework.dll" exited with code 1.

  2. JoeGeeky says:

    I recently left another comment on this post related to a "part of a path" cannot be found, although for some reason it is not showing up. With that said, it appears to be related to two things that were ommitted from the article…  (1) The procedures assume TFSbuild places the source files in a folder named ‘$(BinariesRoot)x86Debug’ folder, and (2) the TFS Build Name cannot have any spaces in it…  After getting past these items thing went well and this is very promising.

    As an aside, the instructions related to "Change references…" do not appear to be valid on the newest release…