Partager via


Documenting Your Code with XML (Visual Basic) 

In Visual Basic, you can document your code using XML

XML Documentation Comments

Visual Basic provides an easy way to automatically create XML documentation for projects. You can automatically generate an XML skeleton for your types and members, and then provide summaries, descriptive documentation for each parameter, and other remarks. With the appropriate setup, the XML documentation is automatically emitted into an XML file with the same name as your project and the .xml extension. For more information, see /doc.

The XML file can be consumed or otherwise manipulated as XML. This file is located in the same directory as the output .exe or .dll file of your project.

XML documentation starts with '''. The processing of these comments has some restrictions:

  • The documentation must be well-formed XML. If the XML is not well formed, a warning is generated and the documentation file contains a comment saying that an error was encountered.

  • Developers are free to create their own set of tags. There is a recommended set of tags (see "Related Sections" in this topic). Some of the recommended tags have special meanings:

    • The <param> tag is used to describe parameters. If used, the compiler will verify that the parameter exists and that all parameters are described in the documentation. If the verification fails, the compiler issues a warning.

    • The cref attribute can be attached to any tag to provide a reference to a code element. The compiler verifies that this code element exists. If the verification fails, the compiler issues a warning. The compiler also respects any Imports statements when looking for a type described in the cref attribute.

    • The <summary> tag is used by IntelliSense in Visual Studio to display additional information about a type or member.

For details on creating an XML file with documentation comments, see the following topics:

See Also

Other Resources

Developing Applications with Visual Basic
Visual Basic Programming Guide