Based on a past post, I have an external targets file you can place in your $(MSBuildExtensionsPath) folder (attached in zip).

 You can call it like this:

  <Import Project="$(MSBuildExtensionsPath)\Sandcastle.targets"/>

<Target Name="AfterCompile">

    <CallTarget RunEachTargetSeparately="true" Targets="DocumentCLR" ContinueOnError="false"/>

    <OnError ExecuteTargets="OnBuildBreak;"/>

  </Target>

<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>

 

The following is configuration from my msbuild response file:

/p:SandcastleDocumentationName=MyProjectDocumentation

/p:SandcastleConfiguration=C:\YOUR\CONFIG\sandcastle.config

/p:SandcastleDocumentationOutput=$(BinariesRoot)\Documentation

/p:SandcastleDependencies="%windir%\Microsoft.NET\Framework\v2.0.50727\*.dll,C:\YOUR\Dependencies\*.dll,%windir%\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.UnitTestFramework\8.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll"

/p:SandcastleHelpGeneration=CHM

 

Note: tested with build 2.0.2426.28539