Creating an Application Development Framework Using Enterprise Templates - Part 3
In Part 2 of this series of articles, you learned how to customize the enterprise templates to create a new template from which we can create a new project. In this part, we will see how to enhance the developer experience (while working with our custom template) by adding functionalities such as adding custom help topics, customizing the Visual Studio .NET Development environment, and so on.
Adding Custom Help Topics to CustomDistributedAppTemplate
In this section, we will see how to add custom help topics to our enterprise template. Custom help topics are very useful when we want to provide guidance to our development teams on how to use the enterprise template. Once these custom help topics are created, we can then easily make them available through the dynamic help window in the Visual Studi.NET IDE. To accomplish this, we need to go through following steps.
- Planning and preparing the help topics that you want to display through the dynamic window
- Creating dynamic help topic category for the new topic—A dynamic help topic category allows us to group related help topics together so that they are displayed together in the dynamic help window.
- Creating context keywords that point to the help topic
- Linking up the project elements with keywords
Plan and prepare the help topics
Before creating the help topics, we need to prepare the help topics that we want to display. These help topics are normally created as HTML files and then linked up to the actual context keywords. In our case, we will create the help topics for the data access SqlHelper class and save the help file in the directory C:\Projects\CustomDistributedAppTemplate\Help\SqlHelperClass.htm.
Creating dynamic help categories
When you bring up dynamic help window from VS.NET, by default, Visual Studio.NET displays a window that is somewhat similar to the following.
In the above window, if we display a separate category named Custom Distributed Application Template, it will be a lot easier for our development teams to find out information on how to use our template. To accomplish this, we need to create a new XML file named CustomHelp.xml that looks like the following.
<?xml version="1.0" encoding="utf-8" ?> <!-- The following is a link to the Dynamic Help schema. --> <DynamicHelp xmlns=http://msdn.microsoft.com/vsdata/xsd/ vsdh.xsd xmlns:xsi="http://www.w3.org/ 2000/10/XMLSchema-instance" xsi:schemaLocation="http://msdn.microsoft.com/ vsdata/xsd/vsdh.xsd"> <LinkGroup ID="customhelp" Title="Custom Distributed Application Template" Priority="2"> <Glyph Expanded="vs:/ctxmsc_show.gif" Collapsed="vs:/ctxmsc_hide.gif"/> </LinkGroup> </DynamicHelp>
Then we will save the above file in the directory <Drive Name>:\Program Files\Microsoft Visual Studio .NET\Common7\IDE\HTML\XMLLinks\1033.
In the above LinkGroup node,
- ID attribute specifies an identifier for this new help topic category
- Title attribute specifies the name of the topic category to display in the dynamic help window
- Priority defines the relative priority for this help topic when compared with the other help topic categories
- Glyph node specifies the icon to display when the help topic is expanded or collapsed.
Creating context keywords that point to the help topic
Using the KItem element, we specify the keyword that we want to use for this topic. This keyword must already exist in Visual Studio.NET. In this case, we are using the keyword VS.SolutionExplorer to target the solution explorer.
<Context> <Keywords> <KItem Name="VS.SolutionExplorer" /> </Keywords> <Links> <LItem URL="C:\Projects\CustomDistributedAppTemplate\Help\ CustomTemplate.htm" LinkGroup="customhelp"> Introduction to Custom Distributed Application Template</LItem> </Links> </Context>
The Context element is added as a child node to the DynamicHelp element. Finally, we specify the URL of the help topic using a LItem element. Here we also specify the LinkGroup attribute to indicate the link group in which to display our topic link. We can reference any of the five default link groups specified in context.xml as well as any new link groups that we define. In this case, we are referencing the LinkGroup named customhelp that we defined previously.
Now, if you create a new project using our enterprise template and bring up Dynamic Help window, you will see a new custom help topic named Custom Distributed Application Template, as shown below.
Clicking on the Introduction to Custom Distributed Application Template will take you to the help topic that is contained in the file CustomTemplate.htm.