Skip to content

Latest commit

 

History

History
111 lines (91 loc) · 3.05 KB

include-visual-cpp.md

File metadata and controls

111 lines (91 loc) · 3.05 KB
title ms.custom ms.date ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic f1_keywords dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
<include> (Visual C++) | Microsoft Docs
11/04/2016
cpp-ide
article
include
<include>
C++
include C++ XML tag
<include> C++ XML tag
392a3e61-0371-4617-8362-446650876ce3
8
mikeblome
mblome
ghogen

<include> (Visual C++)

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. For example, you can use <include> to insert standard "boilerplate" comments that are used throughout your team or company.

Syntax

<include file='filename' path='tagpath' />  

Parameters

filename
The name of the file containing the documentation. The file name can be qualified with a path. Enclose the name in single or double quotation marks. The compiler issues a warning if it does not find filename.

tagpath
A valid XPath expression that selects the desired node-set contained in the file.

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

id
The ID for the tag that precedes the comments. Enclose the name in single or double quotation marks.

Remarks

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

Compile with /doc to process documentation comments to a file.

Example

This is a multifile example. The first file, which uses <include>, contains the following documentation comments:

// xml_include_tag.cpp  
// compile with: /clr /doc /LD  
// post-build command: xdcmake xml_include_tag.dll  
  
/// <include file='xml_include_tag.doc' path='MyDocs/MyMembers[@name="test"]/*' />  
public ref class Test {  
   void TestMethod() {  
   }  
};  
  
/// <include file='xml_include_tag.doc' path='MyDocs/MyMembers[@name="test2"]/*' />  
public ref class Test2 {  
   void Test() {  
   }  
};  

The second file, xml_include_tag.doc, contains the following documentation comments:

<MyDocs>  
  
<MyMembers name="test">  
<summary>  
The summary for this type.  
</summary>  
</MyMembers>  
  
<MyMembers name="test2">  
<summary>  
The summary for this other type.  
</summary>  
</MyMembers>  
  
</MyDocs>  

Program Output

<?xml version="1.0"?>  
<doc>  
    <assembly>  
        <name>t2</name>  
    </assembly>  
    <members>  
        <member name="T:Test">  
            <summary>  
The summary for this type.  
</summary>  
        </member>  
        <member name="T:Test2">  
            <summary>  
The summary for this other type.  
</summary>  
        </member>  
    </members>  
</doc>  

See Also

XML Documentation