Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to get xsd.exe to generate classes with "internal" scope?

I've got a DLL that contains some XSD-generated classes. Unfortunately, XSD.exe makes those classes public, which results in "Missing XML comment for publicly visible type or member XYZ" warnings. Plus, I'd rather not expose those classes from my DLL. Is there a way, short of manually editing the generated .cs, to make those classes internal?

like image 620
Mark Wright Avatar asked Sep 16 '09 21:09

Mark Wright


People also ask

What is Xsd EXE?

The XML Schema Definition (Xsd.exe) tool generates XML schema or common language runtime classes from XDR, XML, and XSD files, or from classes in a runtime assembly.


1 Answers

This is a very short answer which could be expanded to a book.

No, xsd.exe can't do what you want.

However you can use the techniques described in this article to access the XmlCodeExporter class which is part of the framework that generates code from XML schemas. Once this is done, you have a copy of the CodeDOM for the generated code in memory. you can iterate through all the classes in the namespace and set them to internal.

It may be that the effort required to remove this one warning is more than you would like.

Another way to remove the warning is to generate the code in an assembly for which the XML docs are turned off (after all who needs docs for generated code?)

like image 160
Blue Toque Avatar answered Sep 28 '22 11:09

Blue Toque