Documenting has never been so easy
Generate API documentation for your C# and VB .NET code

Sometimes there are cases when XML comments generated by VSdocman can cause VS warnings. It's because VSdocman uses extended syntax. Here we explain how to disable such warnings.

VSdocman supports XML comments for all types of elements, including namespaces. Visual Studio, however, doesn't support XML comments for a namespace.

In C#

You'll get the following warning:

XML comment is not placed on a valid language element
It's numeric code is 1587.

Suppressing is quite easy. In C#, you have two options - you can suppress the warning whether globally for entire project or locally for just a part of your code.

1. Globally

You can enter a comma delimited list of warning IDs in project's Properties - Build tab, Errors and warnings section. So add 1587 there.

2. Locally

Use #pragma warning disable in your code. For example:

#pragma warning disable 1587
/// <summary>
/// This is main namespace.
/// </summary>
/// <remarks>
/// <para>You can navigate to code elements using clickable class diagram below. The
/// diagram can be placed anywhere, e.g. in summary or Remarks section or in its own
/// section as shown here.</para>
/// <para> <img src="ClassDiagram1.cd"/></para>
/// </remarks>
namespace SampleClassLibrary
#pragma warning restore 1587
{
...

 

In VB .NET

You'll get the following warning:

XML documentation comments must precede member or type declarations.

or in older VS versions:

XML comment block cannot be associated with any language element that supports the application of XML documentation comments. XML comment will be ignored.

It's numeric code is 42312.

1. Globally

You need to manually edit project .vbproj file.

  1. Close VS.
  2. Open .vbproj file. Find <NoWarn> tag and add the warning ID there. In our case the ID is 42312: <NoWarn>42312</NoWarn>. Don’t place any whitespaces and newlines in this tag! There is one <NoWarn> section for each configuration (Release/Debug) so you need to edit all of them.
  3. Save the .vbproj file and open VS.

2. Locally (only available since Visual Studio 2015)

Use #Disable Warning in your code. For example:

#Disable Warning BC42312
''' <summary>
''' This is main namespace.
''' </summary>
''' <remarks>
''' <para>You can navigate to code elements using clickable class diagram below. The
''' diagram can be placed anywhere, e.g. in summary or Remarks section or in its own
''' section as shown here.</para>
''' <para> <img src="ClassDiagram1.cd"/></para>
''' </remarks>
Namespace SampleClassLibrary
#Enable Warning BC42312
...

After this, you shouldn’t get specified warnings during the build, nor should you see warning underline during editing.

 

Start generating your .NET documentation now!

DOWNLOAD

Free, fully functional trial

Thanks for building the best .NET documentation solution out there, great work!

H. Armstrong, Software Developer

Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Marketing
Set of techniques which have for object the commercial strategy and in particular the market study.
Quantcast
Accept
Decline
Save