How can I generate an XML-schema from a class in a .NET Standard library?

1.2k views Asked by At

In the past I have been using xsd.exe to generate XML-schemas from classes in .NET framework libraries.

Now, I want to do the same for some classes in a .NET Standard 2.1 library, but I get an error.

Running

C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\xsd.exe $(BinDir)$(TargetName).dll /type:$(ItemFileName)

from the Package Manager Console gives me:

Microsoft (R) Xml Schemas/DataTypes support utility [Microsoft (R) .NET Framework, Version 4.8.3928.0] Copyright (C) Microsoft Corporation. All rights reserved. Error: There was an error processing ''.

  • Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

Maybe, this should have come as no surprise, but I cannot find documentation of a newer version of xsd.exe or of an alternative method for generating XML-schemas. There is no xsd.exe to be found in the .NET Core SDK's. And, in fact, the ticket Port xsd.exe to .NET Core, which is currently open, suggests that for .NET Core there is no support. The same could very well be true for .NET Standard.

I would probably work if copied the classes to a .NET Framework project, but that just feels silly. Still, I may revert to that.

0

There are 0 answers