This documentation is archived and is not being maintained.

/doc (Process Documentation Comments)



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


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

For Visual Studio .NET, only the C# compiler provides this documentation comments feature.

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.

/doc will be ignored in a compilation that uses /incremental; use /incremental- to ensure that file is up to date.

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.

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

See the GotDotNet User Samples Search page ( for a sample of how to format an XML file.

See Commenting Code for information on how Visual Studio will display a report on the structure of your code, to include XML documentation comments.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see Setting Visual C# Project Properties.
  2. Click the Configuration Properties folder.
  3. Click the Build property page.
  4. Modify the XML Documentation File property.

To set this compiler option programmatically

See DocumentationFile Property.


See XML Documentation Tutorial for a sample.

See Also

C# Compiler Options | XML Documentation Tutorial