Creating Internal C# classes from XSD.exe

c#, xsd.exe

Solution

No, it won't create `internal` classes. Classes output by XSD.EXE are intended to be serialized by the `XMLSerializer`. The `XMLSerializer` only supports public classes and thus if XSD output `internal` classes, serialization would fail.

Problem

I'm writing a library that will accept an XML string as input which it will deserialize and do some transformations on. The output will be a separate XML file with a different schema. This internal XML will be following an internal Schema, which I do not wish to expose to the user of the library. The schema is defined in an XSD file in my project which I use XSD.exe (the one that comes bundled with Visual Studio) to create C# classes from. The problem I have is that XSD.exe generates `public` classes. I would want them to be implicit or explicit `internal`. Is there anyway I can make XSD.exe create `internal` classes?

Original source