Suppress Xml warning for ServiceReference.cs

Working with MVC4 and VS2012 , I use the Service Reference , which automatically creates the Reference.cs file. When I create, I get dozens of warnings in the form of errors that are read

'Missing XML comment for public type or member ...'

I found a similar answer here that refers to a workaround found in this blog that suggests adding the following fix to the CSProj file:

 <Target Name="XamlGeneratedCodeWarningRemoved" AfterTargets="XamlMarkupCompilePass1"> <Exec Command="for %%f in (@(XamlGeneratedCodeFiles)) do echo #pragma warning disable > %%f.temp" /> <Exec Command="for %%f in (@(XamlGeneratedCodeFiles)) do type %%f >> %%f.temp" /> <Exec Command="for %%f in (@(XamlGeneratedCodeFiles)) do copy /y %%f.temp %%f" /> <Message Text="XamlGeneratedCodeWarningRemoved: @(XamlGeneratedCodeFiles)" /> </Target> 

But this does not seem to work with the Reference.cs file, perhaps because it targets Xaml ? Can someone tell me how I can fix this to work with the Reference.cs file or suggest another way around this problem?

I cannot just add pragma disable to automatically generated code or disable Xml comments.

+7
source share
2 answers

Updating pre-generated .cs files on the fly causes all sorts of problems with Visual Studio because it will use a copy of in-memory in-memory files . And this will be very annoying due to the integration of Source Control, making files read-only and requiring file verification after each build.

You can also make your Service Client internal by changing its properties. Depending on your settings, the documentation generation will not complain about any method that will not be externally visible. This may still trigger StyleCop, Code Analysis or Resharper warnings, though ...

So, what I usually do, I stick to service references in my own Visual Studio project, create the generated Public code and disable the documentation for the entire project. This also has the advantage that your service reference will use the same bindings regardless of the project in which you included it.

+6
source

I also found that I can set the Service Reference as Internal when creating, which bypasses the Xml issue.

Although this still leaves me with the problem of suppressing StyleCop errors for the generated code, I will create a new question for this.

+1
source

All Articles