The <include> tag lets you refer to comments in another file that describe the types and members in your source code. This is an alternative to placing documentation comments directly in your source code file. By putting the documentation in a separate file, you can apply source control to the documentation separately from the source code. One person can have the source code file checked out and someone else can have the documentation file checked out.

The <include> tag uses the XML XPath syntax. Refer to XPath documentation for ways to customize your <include> use.

Syntax

<include file="filename" path="tagpath[@name='id']" />

where:

filename

The name of the XML file containing the documentation. The file name can be qualified with a path.

tagpath

The path of the tags in filename that leads to the tag name.

name

The name specifier (attribute) in the tag that precedes the comments; name will have an id.

id

The ID for the tag that precedes the comments. It should be a member full identifier in cref syntax.

Examples

Let's have the following XML comments in the source code:

Visual Basic

''' <summary>Our sample property.</summary>

''' <include file="external_comments.xml"

''' path="doc/members/member[@name='P:TestDLL.DllClass1.prop1']/*" />

Property prop1() As String

C#

/// <summary>Our sample property.</summary>

/// <include file="external_comments.xml"

/// path="doc/members/member[@name='P:TestDLL.DllClass1.prop1']/*" />

public string prop1

The external_comments.xml file contains the following:

Example

<?xml version="1.0" encoding="utf-8"?>

<doc>

  <members>

    <member name="P:TestDLL.DllClass1.prop1">

      <remarks>

        This are remarks for prop1.

      </remarks>

    </member>

    <member name="P:TestDLL.DllClass1.prop2">

      <remarks>

        This are remarks for prop2.

      </remarks>

    </member>

  </members>

</doc>

Then resulting XML comment for prop1 property will be:

Example

<summary>Our sample property.</summary>

<remarks>

  This are remarks for prop1.

</remarks>

 

See Also