xsd.exe fails to create common data types out of nested schemas


hi,

with contract first approach have xsd schemas core interface definitions. outsourced common data types (enumerations , length limited string types) in shared common.xsd file in turn <import>ed top level xsd schemas.

we tried generate .cs code files xsd.exe in scenario. generated code files repeatingly contain common data type definitions. leads several compiler errors. using different namespace delcarations each generated class not solve problem: shared character of our common data types lost after code generation xsd.exe!

it seems popular problem, because shared data types commonly used practice. solved problem already? how can deal this? suggestions?

hi, had similiar issue. main reason can't tell xsd.exe tool generate classes first schema , not supporting schemas, little manual cleanup in order.  because of how .net compiles everything, found following workflow helpful:

consider 3 files, common.xsd, obj1.xsd, , obj2.xsd.  obj1 , obj2 both refer common.xsd resolve data types.

create of .cs files using xsd.exe tool end common.cs, obj1.cs, , obj2.cs.

now, go obj1.cs , delete declarations types, enumerations, etc duplicated from the common.cs file.  same obj2.cs file.

finally, add 3 files project.  compiler accurately locate references.

we went 1 step further , added namespace xyz { } declaration within each of .cs files of objects within same namespace.

 

chris lively.



Archived Forums A-B  >  ASMX Web Services and XML Serialization



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'