Setting DocumentationSources Via the Command Line

Jun 25, 2009 at 10:59 PM
Edited Jun 26, 2009 at 4:14 PM

Quoting Eric:

"Starting with SHFB 1.8.0.0, the project passed to the build engine is a clone of the actual project and you can modify it in any way including adding files to it via the MSBuildProject property. These changes are only in effect for the duration of the build and won't affect the actual project."

First off, what I'm trying to do is make a generic help file building process that many projects will use. The idea is to start with a base SHFB template project then dynamically override certain properties via the command line at runtime.

One problem I'm running into is when trying to provide the DocumentationSources via the command line. They appear as below in the project file source:

<DocumentationSources>
   <DocumentationSource sourceFile="Solution01.sln" />
   <DocumentationSource sourceFile="Solution02.sln" />
</DocumentationSources>


I've done a fair amount of Googling to try and figure out how to pass a property like that to MSBuild but without any luck.

Coordinator
Jun 26, 2009 at 7:13 PM

You can specify the inner XML on the command line:

MSBuild -p:DocumentationSources="<DocumentationSource sourceFile='Solution01.sln' /><DocumentationSource sourceFile='Solution02.sln' />" Test.shfbproj.

Note that you need to use single quotes around the solution filenames.  A better approach for the complex properties is to use the target override file and specify the full path to it using the CustomBeforeSHFBTargets property option.  The override file contains the settings to override and you'd have them entered just like they would be in the standard project file.

MSBuild -p:CustomBeforeSHFBTargets=C:\Path\Overrides.proj Test.shfbproj

See http://www.ewoodruff.us/shfbdocs/Index.aspx?topic=html/8ffc0d37-0215-4609-b6f8-dba53a6c5063.htm#TargetOverrides for more information.

Eric