This project has moved and is read-only. For the latest updates, please go here. - SHFB(0,0): error BE0020: Unknown field tag

Topics: Developer Forum, Project Management Forum, User Forum
Feb 13, 2012 at 6:52 AM


we are using the SHFB ( In order to create a version string within the help documentation we are using a custom msbuild task:

<UsingTask TaskName="Tools.MsbuildTasks.ExtractProductVersion" AssemblyFile="..\..\..\Output\$(Configuration)\Tools.MsbuildTasks.dll" />

<!-- Import the SHFB build targets -->

<Import Project="$(SHFBROOT)\SandcastleHelpFileBuilder.targets" />

<Target Name="BeforeBuildHelp">

   <ExtractProductVersion VersionInfoPath="..\..\..\Tools\Build\VersionInfo.xml">

     <Output TaskParameter="BuildVersion" PropertyName="BuildVersion" />


   <Warning Text="$(BuildVersion)" />



As far as I understand the build process, overriding the “BeforeBuildHelp” is the correct place. In the tokens file we reference the msbuild variable like: {@BuildVersion}.

Creating the documentation via the console and msbuild everything works as expected. I can create the help documentation and the documentation contains the corresponding build version string. But when I try to create the documentation via the the SHFB or with VS2010 I get the following error:

SHFB(0,0): error BE0020: Unknown field tag: 'BuildVersion'

It seems that within VS2010 or SHFB the msbuild variable is not known. Any ideas what’s going wrong there?


Feb 14, 2012 at 8:23 PM

The standalone GUI bypasses the build tasks and builds the project directly so it won't use the BeforeBuildHelp target.  Visual Studio should be using them but I don't know why it would be bypassing the targets.  You can try adding a BuildVersion variable to the project's UserDefinedProperties property so that it at least exists and the build will not fail.  You might see if that's enough to get it to pass the new value through when built from within Visual Studio.  I'll see if I can duplicate the problem.



Feb 15, 2012 at 8:03 AM

Hi Eric,

thanks for your update. So do you have an idea how to handle this in both scenarios (standalone and msbuild). Your suggestion above will work, but will produce a help file which doesn't contain the correct version info (at least for the standalone build).


Feb 15, 2012 at 8:24 PM

The standalone GUI invokes the build engine directly so in order to use MSBuild it would have be be reworked to spawn MSBuild instead.  The workaround for now when building manually would be to edit the property and set it to the right value.