Reputation: 5462
I have a project with over 500 Missing XML Comment
warnings. I know I can remove the XML Comment feature, or paste empty comment snippets everywhere, but I'd prefer a generic solution where I can make one change that disables all warnings of this type.
What I do just now is putting
///<Summary>
///
///</Summary>
or
#pragma warning disable 1591
was just curious if it would be possible.
Upvotes: 254
Views: 148922
Reputation: 1464
You can disable this selectively on a per-file basis using an .editorconfig
file - for example, if you have a specific source file (or multiple files), you can use something like:
# single file
[IgnoreThisFile.cs]
dotnet_diagnostic.CS1591.severity = none
# multiple files, matching on specific naming convention
[*{Type,Stuff,Things}.cs]
dotnet_diagnostic.CS1591.severity = none
Note that I've had mixed experiences with consistently managing this warning but in the current version (17.4.4+) of VS2022, it seems to stick. Make sure the .editorconfig
is at a "high" enough level in your folder structure that it applies across all of your source files (or alternatively, use multiple files at specific folder levels depending on your needs).
Upvotes: 6
Reputation: 4838
To fix a violation of this rule, enable the XML documentation file as part of the project output by adding true to your project file.
Mentioned at:
Upvotes: 1
Reputation: 334
Visual Studio 2022:
I would recommend to use .editorconfig
file in the Visual Studio to set a common code style across all solution.
In this case, just add this code manually to the .editorconfig
file:
# SA0001: XML comment analysis is disabled due to project configuration
dotnet_diagnostic.SA0001.severity = none
NOTE: For me, suppressing SA0001
from the Editor Config designer not working.
Only manual setting rule in the file.
Upvotes: 11
Reputation: 925
This would have been a comment but I couldn't get it to fit the limitation:
I would love to disable them just for the Reference.cs and WebService imports. Actually, I'm using a macro to do it for a file. Just open the file and execute this macro (tested in VS2010):
Sub PragmaWarningDisableForOpenFile()
DTE.ActiveDocument.Selection.StartOfDocument()
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.LineUp()
DTE.ActiveDocument.Selection.Insert("#pragma warning disable 1591")
DTE.ActiveDocument.Selection.EndOfDocument()
DTE.ActiveDocument.Selection.NewLine()
DTE.ActiveDocument.Selection.Insert("#pragma warning restore 1591")
DTE.ActiveDocument.Save()
End Sub
There is really no way to do this automatically? You would have to redo this every time the auto-generated code overrides the file.
Upvotes: 4
Reputation: 1086
You can also modify your project's .csproj
file to include a <noWarn>1591</noWarn>
tag inside of the first <PropertyGroup>
.
Originally from Alexandru Bucur's Article Here
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
...
<NoWarn>1591</NoWarn>
</PropertyGroup>
...
</Project>
Upvotes: 86
Reputation: 179
Go into project properties and uncheck the generate XML document option.
Recompile and the warnings should go away.
Upvotes: 17
Reputation: 1657
Disable the warning:
Go to the Project properties(Right click on your project and choose Properties from the context menu)
Go to the Build tab
Add 1591 to the Suppress warnings textbox
Upvotes: 103
Reputation: 7856
As suggested above, in general I don't think that these warnings should be ignored (suppressed). To summarise, the ways around the warning would be to:
Properties
> Build
> Errors and warnings
> Suppress warnings
by entering 1591Properties
> Build
> Output
#pragma warning disable 1591
at the top of the respective file and #pragma warning restore 1591
at the bottomUpvotes: 381