\Working\sandcastle.config is not expanding a reference to %ProgramFiles%

Topics: Developer Forum, User Forum
Dec 15, 2010 at 7:19 PM

I am using Sandcastle and SHFB to produce Website documentation of a C# VS 2005 project. This is a great tool by the way, we are really impressed with the results that we are seeing.

However, we are seeing some strange behavior when trying to build our shfbproj file via our Continuous Integration server (Hudson). I am using MSBuild /p:Configuration=Release myproject.shfbproj, when I run this from a command window locally on my build server it produces the Help documentation with out errors.

When I run the same MSBuild command from a remote Hudson job my build fails. From what I can tell the failure is caused by the environment variable %ProgramFiles% not being properly expanded when my Working/sandcastle.conf file is created.

This is the jest of the error that I am seeing in my log file:

"Could not find a part of the path 'C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.0'."

First I cannot determine why it is prefixing %ProgramFiles% with my working directory path. Second I don't know why it is not expanding the environment variable %ProgramFiles%? If you need any more details from me just let me know, I can send my complete working directory if that is useful.

Thanks in advance for your efforts,

-reagan

 

The last lines from my "LastBuild.log" file

 Info: SyntaxComponent: Loaded 1 syntax generators.
 Info: CopyFromIndexComponent: Instantiating component.
 Info: CopyFromIndexComponent: Searching for files that match 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\en\*.
xml'. Info: CopyFromIndexComponent: Searching for files that match '%ProgramFiles%\Reference Assemblies\Microsoft\
Framework\v3.0\*.xml'. BUILDASSEMBLER : error : BuildAssembler: An error occured while initializing the build component 'Microsoft.Ddue.
Tools.CopyFromIndexComponent' in the component assembly 'C:\Program Files\Sandcastle\ProductionTools\
BuildComponents.dll'. The error message and stack trace follows: System.IO.DirectoryNotFoundException:
Could not find a part of the path
'C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.0'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.Directory.InternalGetFileDirectoryNames(String path, String userPathOriginal, String
searchPattern, Boolean includeFiles, Boolean includeDirs, SearchOption searchOption) at System.IO.Directory.GetFiles(String path, String searchPattern, SearchOption searchOption) at System.IO.Directory.GetFiles(String path, String searchPattern) at Microsoft.Ddue.Tools.IndexedDocumentCache.AddDocuments(String wildcardPath) at Microsoft.Ddue.Tools.IndexedDocumentCache.AddDocuments(String baseDirectory, String wildcardPath, Boolean recurse) at Microsoft.Ddue.Tools.CopyFromIndexComponent..ctor(BuildAssembler assembler, XPathNavigator configuration) Last step completed in 00:00:20.8126 </buildStep> <buildStep step="Failed"> SHFB: Error BE0043: Unexpected error detected in last build step. See output above for details. </buildStep> </shfbBuild>

The component block from my Working\sandcastle.config file

 

    <component type="Microsoft.Ddue.Tools.CopyFromIndexComponent" assembly="C:\Program Files\Sandcastle\ProductionTools\BuildComponents.dll">
     <index name="comments" value="/doc/members/member" key="@name" cache="100">
      <data files="C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\en\*.xml" />
      <data files="%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.0\*.xml" />
      <data files="%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.5\*.xml" />

      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\Database.xml" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\DatabaseProducer.xml" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\DeviceReaderCommon.xml" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\DeviceReaderService.xml" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\Framework.xml" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\MessageProducer.xml" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\OutboundMessageManager.xml" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\ServiceProcess.xml" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\Shared.xml" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\TCPIPConnectionManager.xml" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\VehicleProducer.xml" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\XMLMessageDatabaseProducer.xml" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\XMLMessageProducer.xml" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\XMLVehicleProducer.xml" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\{964b675d-d4d4-4458-8496-9772034c6d11}" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\{69c91ea9-83e9-4693-a1a1-76e5cbb3ac61}" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\{9f6285d0-deb1-47f3-bff4-bbaefe7718ea}" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\{6f2f6103-efc2-4a33-84cd-e30e62959dba}" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\{33e95a62-5fb1-480b-901d-426c832695e3}" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\{b4318a6c-be3f-4833-8085-16bef647e536}" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\{33f80065-ff71-4848-9fb8-b214f12aa2ee}" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\{45061bff-250d-4205-a49a-ce8a7604d18c}" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\{0e04435b-fe27-451b-9e83-281f2f3baba8}" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\{356ebba5-0d11-43c5-9721-0e05a10bd4fc}" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\{e5868b8c-5847-4482-9726-a9767587816b}" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\{c01509af-d240-4dfa-bb88-7956601242e0}" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\{ff7f9fc4-1749-44ce-a3e0-3e2af7d3e839}" />
      <data files="C:\cygwin\home\Administrator\workspace\Device_Reader\DeviceReaders\Help\Working\{cd8bbc52-4ae2-406a-bbf7-19fd07de4097}" />
     </index>
     <copy name="comments" source="*" target="/document/comments" />
    </component>
Coordinator
Dec 15, 2010 at 8:20 PM

As I wrote over on the MSDN Documentation Forum, the comment file paths are generated at build time.  SHFB attempts to expand the "%ProgramFiles%" variable using Environment.ExpandEnvironmentVariables().  If it isn't doing that, then the variable is probably not defined when running in the context of the remote build.

Eric