Creating a class from an xsd file in the networking core

I need to create a class from xsd in networking core. In dotnet standard, I used command xsd filename.xsd /c.

But how to create this class in pure core. Does anyone know how to do this?

When I add the class generated with xsd.exe I get several errors.

Example

    Error   CS0234  The type or namespace name 'SerializableAttributeAttribute' does not exist in the namespace 'System' (are you missing an assembly reference?)


Error   CS0234  The type or namespace name 'DesignerCategoryAttribute' does not exist in the namespace 'System.ComponentModel' (are you missing an assembly reference?) 

Error   CS0234  The type or namespace name 'XmlTypeAttributeAttribute' does not exist in the namespace 'System.Xml.Serialization' (are you missing an assembly reference?)

Error   CS0246  The type or namespace name 'AnonymousType' could not be found (are you missing a using directive or an assembly reference?) 

      

Attributes from a class in an autogenous file

[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]

      

+4


source to share


3 answers


Now I have solved this problem by adding nugets to my project.

  • System.Xml.XmlSerializer

Solution: Fixes serialization attributes issues other than DesignerCategoryAttribute



  • Newtonsoft.json

Solution: removes the DesignerCategoryAttribute

Now you can compile the generated xsd.exe class and use it in a clean kernel

+7


source


There is no way to be up to date, but if you see this one , it is part of a future .net core release (.Net Core 1.2 release at Q2 2017).



If you need more information, see this discuss and especially this paragraph .

+1


source


netstandard2.0 can compile xsd.exe generated files without issue

+1


source







All Articles