msbuildteamcitysandcastleshfb

Mysteriously failing sandcastle build only when built by TeamCity


I have a rather large solution, which contains two documentation projects based on Sandcastle + Sandcastle Help File Builder (SHFB). These projects both build correctly from the command line (msbuild project.shfb) and also using the beta version of SHFB Visual Studio 2010 integration.

When I run the build in TeamCity though, I get a mysterious build failure within the documentation build. The SHFB log says this:

      [Sandcastle Help File Builder, version 1.9.3.0]
      Cached Resolve Reference  Links 2 Component.  Copyright © 2006-2011, Eric Woodruff, All Rights Reserved
      http://SHFB.CodePlex.com
  Info: CachedResolveReferenceLinksComponent: Loaded 61 cached MSDN URL entries
  Info: SaveComponent: Instantiating component.
  Info: BuildAssembler: Building topic N:MyProject
  Info: BuildAssembler: Building topic T:MyProject.ActionNotImplementedException
  Info: BuildAssembler: Building topic AllMembers.T:MyProject.ActionNotImplementedException
  Info: BuildAssembler: Building topic Methods.T:MyProject.ActionNotImplementedException
  Info: BuildAssembler: Building topic Properties.T:MyProject.ActionNotImplementedException
  Info: BuildAssembler: Building topic Overload:MyProject.ActionNotImplementedException.#ctor
  Info: BuildAssembler: Building topic M:MyProject.ActionNotImplementedException.#ctor
  Info: BuildAssembler: Building topic M:MyProject.ActionNotImplementedException.#ctor(System.String)
BUILDASSEMBLER : error : CachedCopyFromIndexComponent: An access error occured while attempting to load the file 'C:\Program Files (x86)\Sandcastle\Data\Reflection\mscorlib.xml'. The error message is: Could not find file 'C:\Program Files (x86)\Sandcastle\Data\Reflection\mscorlib.xml'. [C:\BuildAgent\work\37c2302839b8996f\Help\Output\Developer\Working\BuildReferenceTopics.proj]
    Last step completed in 00:02:31.3827
</buildStep>
<buildStep step="Failed">  

SHFB: Error BE0043: Unexpected error detected in last build step.  See output above for details.

</buildStep>
</shfbBuild>

Sure enough, the file that Sandcastle is looking for (mscorlib.xml) is not there. But the build works outside of TeamCity, so I would conclude that Sandcastle is only looking for that file when TeamCity is onvolved. So, why does this only cause a failure in TeamCity and not from the command line within msbuild? I'd appreciate any troubleshooting hints because I'm out of inspiration.

Clarification (thanks @Sayed): The TeamCity build agent is the same computer where I can successfulyl run the command line build, so it's the same computer for everything mentioned above. The TeamCity Server is a different computer but that takes no part in the build.


Solution

  • I hit the same problem today, and I eventually managed to solve it: you just need to delete the cache files in the %USERPROFILE%\AppData\Local\EWSoftware\Sandcastle Help File Builder\Cache folder.

    (note: since your problem is related to TeamCity, perhaps the files are in the TeamCity data folder instead)

    In my case, I think it's because the cache files had been generated with an older version of SHFB, and were not compatible with the new version.