2

I have a generated interface from a service reference. The interface is missing XML comments so I get warnings (that are handled as Errors in my VS configuration). How can I exclude this interface from the warnings?

1 Answers1

1

Take a look at this MS Forum's discussion of the problem:

http://social.msdn.microsoft.com/Forums/en-US/9bbad4cc-e229-49da-a6f7-3cdf470ac53a/compiler-warning-for-missing-xml-comment-when-i-have-generated-code?forum=devdocs

Summarizing (read: copy -n- pasting) some of the possible solutions from the thread:

  • Suppress the warning by entering it's number (1591 for C#) in the Suppress Warnings field on the Build tab of the project properties. Note: this will suppress 1591 for ALL code files in the project.

  • Update the template for the autogenerated files, adding #pragma warning disable 1591 (see http://msdn.microsoft.com/en-us/library/ms185319(VS.90).aspx)

  • Right click on the service reference and choose configure Change "Access level for generated classes" to Internal. Click OK.

  • Modify the MSBuild targets file to include an AfterTarget that injects the 1591 pragma: http://lvquoc.blogspot.com/2010/11/disable-xml-comment-warning-in-workflow.html

  • Move the generated code into a separate project, and disable XML documentation on that project.

If you do not plan on regenerating this file very often, or at all, you could always just open the reference.cs file and add the #pragma's to the top and bottom of the file yourself: ... edit the Reference.cs file itself and add "#pragma warning disable 1591" at the top and "#pragma warning restore 1591" at the bottom.

Lynn Crumbling
  • 12,985
  • 8
  • 57
  • 95