Passing parameters between HelpStudio and Document! X


I think this is an useful (undocumented though) feature that could help you a lot if you use both HelpStudio and Document!X. If you have only one help project this probably will not help you much, but if you need to maintain more (about 20 in my case) you will find this hint invaluable (and have to buy me a beer Big Smile.

When you build HelpStudio project that has Document!X project attached, all properties set in HelpStudio project are passed to the Document! X project. What is the interesting part is that you can pass (and use) properties that are not available in the Document! X project. Here is an example:

We want to use our own filter for our Help2 documentation so all our topics have an XML island is an attribute similar to this one :
        <MSHelp:Attr Name="property1" Value="value1"/>

Later, when we register the Help2 files in MSDN/VisualStudio we register a filter that would look for all topics that have such attribute. Cute! :)
What is important here is to have topics generated by HelpStudio and those generated by Document!X have the same attribute (otherwise they won't appear together when you apply the filter). For that purpose we have modified the HelpStudio template a bit and included a new property of type String. That property (let's say its name is Property1) holds the Value of the MSHelp attribute. Then we have modified a bit the XML Island template property (only in HelpStudio3 templates) to have one additional row:

 <MSHelp:Attr Name="property1" Value="%%Property1%%"/>

Now we will have our HelpStudio topics filtered by our custom filter. What follows is to have the Document!X topics use the same filter. In Document! X project properties go to Microsoft .NET Options section (the last one) and there find XML Attributes box (lower left). Set the same attributes as in HelpStudio:

<MSHelp:Attr Name="property1" Value="%%Property1%%"/>

Note that we haven't touched anything in Document! X template, which means that we don't have Property1 property. Normally, if you build the Document! X project alone, you will see an error message in the HTML source, because Document!X cannot resolve Property1. But, if you build the HelpStudio project (along with Document! X) you will see that all Document!X generated topics have our custom attribute and Property1 resolved to the value that was set in HelpStudio project.

So using this technique, you can have all you HelpStudio and Document!X projects use the same  MSHelp attribute line and control  project-specifics only through HelpStudio.

Well, as I see my post, the things look much more complicated than they actually are, but if you try to follow what I wrote you'll see that it is really easy to do. I really hope that you'll find that one useful enough to have it in your projects.


Nikolay Dobrev



1 comment

Please sign in to leave a comment.