using xsd.exe to generate c# files, getting error and warnings

前端 未结 2 1495
轮回少年
轮回少年 2020-12-29 04:47

This is the command i\'m running:

xsd.exe -c -l:c# D:\\Documents\\DEV\\SARPilot\\Docs\\schemas\\06-141r2\\06-141r2.xsd

These are the errors

相关标签:
2条回答
  • 2020-12-29 05:10

    The XML Schema included in the PDF document you linked has references to several other XSD files using the <import> element. You will need to download these additional schema files and make sure that the path references in the <import> elements are pointing to the correct locations on your local computer.

    If you are still getting errors, it is because xsd.exe could not follow up on external references. To solve this issue, specify all the required XSD files directly on the command line as follows:

    xsd.exe /c MySchema.xsd Import01.xsd Import02.xsd Include01.xsd Include02.xsd

    where Import01.xsd, Import02.xsd, Include01.xsd and Include02.xsd are XSD files referenced via import and include elements in MySchema.xsd.

    0 讨论(0)
  • 2020-12-29 05:12

    I had the same issue and this is how I solved it:

    1) Copied all the xsd files referenced in xsd targeted for code generation to the same location i.e. "C:\Projects\Project1\Documents\xsds\strucutre". 2) Mentioned all the referred xsd files while executing xsd.exe:

    C:\Projects\Project1\Documents\xsds\strucutre>"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\xsd" structure.xsd RefXsd1.xsd RefXsd2.xsd RefXsd3.xsd /c /o:C:\Projects\Project1\Documents\ClassStructure

    A c-sharp file, containing the entities mentioned in xsds, was generated under folder C:\Projects\Project1\Documents\ClassStructure.

    Hope this helps!

    0 讨论(0)
提交回复
热议问题