SandcastleBuilder.Utils.MSBuild.MRefBuilder task could not be loaded

Topics: User Forum
Sep 23, 2009 at 10:55 AM

Hi!

I'm building the documentation in CruiseControl.NET via msbuild command:

<msbuild>
  <executable>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
  <projectFile>D:\Builds\Projects\TrunkTestsDeployment\MyProject.shfbproj</projectFile>
  <buildArgs>/p:SHFBROOT=&quot;C:\Program Files\EWSoftware\Sandcastle Help File Builder&quot; /noconsolelogger /v:diagnostic</buildArgs>
  <logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
</msbuild>

and I get such error (see whole SHFB LastBuild.log)

<?xml version="1.0" encoding="utf-8"?>
<shfbBuild product="Sandcastle Help File Builder Utilities" version="1.8.0.2" projectFile="D:\Builds\Projects\TrunkTestsDeployment\MyProject.shfbproj" started="23.9.2009 13:19:27">
<buildStep step="Initializing">
</buildStep>
<buildStep step="ClearWorkFolder">
Clearing working folder...
</buildStep>
<buildStep step="FindingTools">
Finding tools...
Found Sandcastle in 'C:\Program Files\Sandcastle\'
Found HTML 1.x help compiler in 'C:\Program Files\HTML Help Workshop\'
</buildStep>
<buildStep step="ValidatingDocumentationSources">
Validating and copying documentation source information
Source: D:\Builds\Projects\TrunkTestsDeployment\Zip\MyAssembly1.dll
    Found assembly 'D:\Builds\Projects\TrunkTestsDeployment\Zip\MyAssembly1.dll'
Source: D:\Builds\Projects\TrunkTestsDeployment\Zip\MyAssembly1.xml
Source: D:\Builds\Projects\TrunkTestsDeployment\Zip\MyAssembly2.dll
    Found assembly 'D:\Builds\Projects\TrunkTestsDeployment\Zip\MyAssembly2.dll'
Source: D:\Builds\Projects\TrunkTestsDeployment\Zip\MyAssembly2.xml

Copying XML comments files
    D:\Builds\Projects\TrunkTestsDeployment\Zip\MyAssembly1.xml -&gt; D:\Builds\Projects\TrunkTestsDeployment\Zip\Help\Working\MyAssembly1.xml
    D:\Builds\Projects\TrunkTestsDeployment\Zip\MyAssembly2.xml -&gt; D:\Builds\Projects\TrunkTestsDeployment\Zip\Help\Working\MyAssembly2.xml
</buildStep>
<buildStep step="GenerateSharedContent">
Generating shared content files (en-US, English (United States))...
    Last step completed in 00:00:00.2003
</buildStep>
<buildStep step="GenerateApiFilter">
Generating API filter for MRefBuilder...
    Last step completed in 00:00:00.2504
</buildStep>
<buildStep step="GenerateReflectionInfo">
Generating reflection information...
[C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe]
D:\Builds\Projects\TrunkTestsDeployment\Zip\Help\Working\GenerateRefInfo.proj(35,5): error MSB4062: The &quot;SandcastleBuilder.Utils.MSBuild.MRefBuilder&quot; task could not be loaded from the assembly \SandcastleBuilder.Utils.dll. Could not load file or assembly 'file:///D:\SandcastleBuilder.Utils.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the &lt;UsingTask&gt; declaration is correct, and that the assembly and all its dependencies are available.
    Last step completed in 00:00:01.1216
</buildStep>
<buildStep step="Failed">

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

</buildStep>
</shfbBuild>

Here is the whole GenerateRefInfo.proj which seems to be OK

<Project DefaultTargets="Generate" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
  <!-- Sandcastle Help File Builder Tasks.  http://www.codeplex.com/SHFB -->
  <UsingTask TaskName="SandcastleBuilder.Utils.MSBuild.MRefBuilder" AssemblyFile="$(SHFBROOT)\SandcastleBuilder.Utils.dll" />
  <UsingTask TaskName="SandcastleBuilder.Utils.MSBuild.XslTransform" AssemblyFile="$(SHFBROOT)\SandcastleBuilder.Utils.dll" />
  <!-- Task properties -->
  <PropertyGroup>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
    <DocInternals>false</DocInternals>
    <SandcastlePath>C:\Program Files\Sandcastle\</SandcastlePath>
    <WorkingFolder>D:\Builds\Projects\TrunkTestsDeployment\Zip\Help\Working\</WorkingFolder>
  </PropertyGroup>
  <!-- The common targets require OutputPath to be valid -->
  <PropertyGroup>
    <OutputPath>.\</OutputPath>
  </PropertyGroup>
  <!-- Import the common targets -->
  <Import Project="$(MSBuildBinPath)\Microsoft.Common.targets" />
  <!-- This defines the dependencies for the Generate target -->
  <PropertyGroup>
    <GenerateDependsOn>
      ResolveReferences;
      BeforeGenerateRefInfo;
      GenerateRefInfo;
      AfterGenerateRefInfo
    </GenerateDependsOn>
  </PropertyGroup>
  <Target Name="Generate" DependsOnTargets="$(GenerateDependsOn)" />
  <!-- The Generate Ref Info target -->
  <Target Name="GenerateRefInfo">
    <!-- Run MRefBuilder.  Reference build items are added to this template by
         the build process.  The ResolveReferences dependency target will
         resolve them to absolute paths that can be passed to MRefBuilder
         using the /dep command line option.  Assembly build items are added
         by the build process to define the assemblies to reflect. -->
    <MRefBuilder DocumentInternals="$(DocInternals)" SandcastlePath="$(SandcastlePath)" WorkingFolder="$(WorkingFolder)" Assemblies="@(Assembly)" References="@(ReferencePath)" />
    <!-- Merge duplicate topics (if any) -->
    <Copy SourceFiles="reflection.org" DestinationFiles="reflection.all" />
    <XslTransform SandcastlePath="$(SandcastlePath)" WorkingFolder="$(WorkingFolder)" Transformations="ProductionTransforms\MergeDuplicates.xsl" InputFile="reflection.all" OutputFile="reflection.org" />
  </Target>
  <!-- The following targets may be overridden or replaced to perform
       additional processing. -->
  <Target Name="BeforeGenerateRefInfo" />
  <Target Name="AfterGenerateRefInfo" />
  <ItemGroup>
    <Assembly Include="D:\Builds\Projects\TrunkTestsDeployment\Zip\MyAssembly1.dll" />
    <Assembly Include="D:\Builds\Projects\TrunkTestsDeployment\Zip\MyAssembly2.dll" />
  </ItemGroup>
</Project>

Do you have any idea what could be wrong?

Thanks,
Petr

MyAssembly1
Sep 23, 2009 at 11:40 AM

More info: I just checked the environment variables for the account under the automated build is running and those are OK, i.e. PATH for the user is completely missing and DXROOT is set correctly to C:\Program Files\Sandcastle.

Petr

Coordinator
Sep 23, 2009 at 3:08 PM

Several MSBuild projects are used during the build and they expect to find SHFBROOT defined in the environment.  If you can't define it there, you can add a conditional property to the projects to help them find it.  See this thread and the related work item: http://shfb.codeplex.com/Thread/View.aspx?ThreadId=68005

Eric

 

Sep 24, 2009 at 7:56 AM

Thanks Eric for quick reply! Now I understood the problem and put the SHFBROOT property

<SHFBROOT Condition="'$(SHFBROOT)' == ''">C:\Program Files\Sandcastle Help File Builder</SHFBROOT>

into all project files, i.e. MyProject.shfbproj and into all C:\Program Files\Sandcastle Help File Builder\Templates\*.proj files where it has a sense.

But the build failed again :-( It failed in the middle of BuildReferenceTopics task without any exception or log entry. I can see this in LastBuild.log:

 


<buildStep step="BuildReferenceTopics">
Building reference help topics...
[C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe]
BuildReferenceTopics:
BuildAssembler (v2.4.10520.1)
Copyright c Microsoft 2006
Info: CopyFromFileComponent: Instantiating component.
Info: CopyFromFileComponent: Loading data file 'C:\Program Files\Sandcastle\Presentation\vs2005\Transforms\skeleton.xml'.
.
.
.
Info: BuildAssembler: Building topic T:MyNamespace.MyClass
Info: BuildAssembler: Building topic AllMembers.T:MyNamespace.MyClass
Info: BuildAssembler: Building topic Methods.T:MyNamespace.MyClass
Info: BuildAssembler: Building topic Properties.T:MyNamespace.MyClass
Info: BuildAssembler: Building topic Overload:MyNamespace.MyClass.#ctor
Info: BuildAssembler: Building topic Overload:MyNamespace.MyClass.DeriveContext
Info: BuildAssembler: Building topic M:MyNamespace.MyClass.#ctor

 

This is the exactly last line in the log file. But if I run it from SHFB GUI everything is OK and LastBuild.log looks like

.
.
.
  Info: BuildAssembler: Building topic T:MyNamespace.MyClass
  Info: BuildAssembler: Building topic AllMembers.T:MyNamespace.MyClass
  Info: BuildAssembler: Building topic Methods.T:MyNamespace.MyClass
  Info: BuildAssembler: Building topic Properties.T:MyNamespace.MyClass
  Info: BuildAssembler: Building topic Overload:MyNamespace.MyClass.#ctor
  Info: BuildAssembler: Building topic Overload:MyNamespace.MyClass.DeriveContext
  Info: BuildAssembler: Building topic M:MyNamespace.MyClass.#ctor(OtherNamespace1.OtherClass1,OtherNamespace2.OtherStruct2)
  Info: BuildAssembler: Building topic M:MyNamespace.MyClass.#ctor(OtherNamespace1.OtherClass1,OtherNamespace2.OtherClass2)
  Info: BuildAssembler: Building topic P:MyNamespace.MyClass.ApplicationInstance

See the difference on the 3rd line from the end. Do you have any explanation or suggestion, please?

Thanks,
Petr