SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Matt Ward

XML Comments

SharpDevelop has support for adding and previewing XML documentation comments in C# and VB.NET code. It also ships with Microsoft's Sandcastle so you can generate your help file directly from the development environment.

Adding XML Comments

In a C# source file, typing in /// before a method will start an XML comment and SharpDevelop will generate a basic comment based on the method parameters and return value.


In VB.NET an XML comment starts with '''.

VB.Net XML comment created

As you type SharpDevelop provides XML element completion inside the comment.

XML comment completion

Previewing the XML Comment

With the cursor inside the comment, from the Tools menu select Quick XML doc, or alternatively use the keyboard shortcut Ctrl+Q. This opens up a window showing you a preview of the XML comment.

XML doc preview

Generating Documentation

By default the compiler does not generate XML comment documentation, to turn this on, select the name of the project in the Project Explorer, right click and select Properties. The project options are then opened. Select the Compiling tab and enable the XML comment generation by ticking the XML documentation check box.

Enabling XML comment generation in the project options

XML comment documentation will then be generated from the code when the project is compiled. Once compilation is complete you can use Sandcastle to generate help documentation. From the Project menu, select Build documentation from XML comments.

Build documentation from XML comments menu item

This runs the Sandcastle application where you can generate various types of documentation, such as MSDN-style HTML Help (.chm), Visual Studio .NET Help (HTML Help 2), and MSDN style web pages.


< previous | home | next >

Published Jul 05 2006, 11:58 AM by MattWard
Filed under:


No Comments
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this ( email address.