I'm using the tool xsd.exe
in several projects to generate classes for my data model.
When turning on documentation file generation in my csproj the compiler starts to show lots of warnings of type: CS1591:Missing XML comment for publicly visible type or member
pointing at generated constructors.
As this is kind of intended behavior I am trying to figure out how to suppress these warnings.
But only for the types generated by xsd.exe
which are contained in a single source file.
The file content will be replaced by the xsd.exe
the next time I run it.
Any modifications to the file will be lost in that process.
So adding a #pragma warning disable
to the file is not a solution here
(I sometimes even use a build target which regenerates the code on Build).
But .NET seems to have a builtin mechanic for this case: SuppressMessageAttribute
at assembly level (Microsoft Docs: Suppress warnings).
So I went and created a file GlobalSuppressions.cs
with the following content:
[assembly: SuppressMessage("Compiler",
"CS1591:MissingXmlCommentForPubliclyVisibleTypeOrMember",
Justification = "Generated code",
Scope = "member",
Target = "M:Company.IO.Component.Concrete.Configuration.ConfigItem.#ctor")]
But the suppression is being ignored.
Anyone any ideas?