/doc (C# Compiler Options)

The /doc option allows you to place documentation comments in an XML file.



  • file
    The output file for XML, which is populated with the comments in the source code files of the compilation.


In source code files, documentation comments that precede the following can be processed and added to the XML file:

The source code file that contains Main is output first into the XML.

To use the generated .xml file for use with the IntelliSense feature, let the file name of the .xml file be the same as the assembly you want to support and then make sure the .xml file is in the same directory as the assembly. Thus, when the assembly is referenced in the Visual Studio project, the .xml file is found as well. See Supplying Code Comments and for more information.

Unless you compile with /target:module, file will contain <assembly></assembly> tags specifying the name of the file containing the assembly manifest for the output file of the compilation.


The /doc option applies to all input files; or, if set in the Project Settings, all files in the project. To disable warnings related to documentation comments for a specific file or section of code, use #pragma warning.

See Recommended Tags for Documentation Comments for ways to generate documentation from comments in your code.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Properties page.

  2. Click the Build tab.

  3. Modify the XML documentation file property.

For information on how to set this compiler option programmatically, see DocumentationFile.

See Also


How to: Modify Project Properties and Configuration Settings

Other Resources

C# Compiler Options