I need to generate a class from an xsd in net core.
In dotnet standard I used commandline xsd filename.xsd /c.
But how to I create this class in net core.
Anyone knows how to do this?
When I add a 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 autogen 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)]
To create an XML file from an XSD file: Right-click the XML Documents folder in your data development project, and select New > XML. The New XML File wizard opens.
To create the wsdl out of xsd, we need to have an xsd having the parameters with types defined to it. So lets create an xsd called helloWorld which accepts name and gender as request and returns greetings as response. To create an xsd, Create a project (dynamic web project or simple java project).
I have now solved this issue with adding nugets to my project.
Solution: Removes the serializations attribute issues except the DesignerCategoryAttribute
Solution: Removes the DesignerCategoryAttribute
Now it is possible to compile the xsd.exe generated class and use it in net core
netstandard2.0 can compile xsd.exe generated files with no problems
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With