使用xsd为xml文件生成c#代码时出现错误:
名称空间'System'中不存在类型或命名空间名称'SerializableAttribute'(您是否缺少程序集引用?)
名称空间'System.ComponentModel'中不存在类型或命名空间名称'DesignerCategoryAttribute'(您是否缺少程序集引用?)
生成的错误代码:
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.17929")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
我试着寻找答案。我发现的唯一的事情就是: http://support.microsoft.com/kb/916649
但这对我不起作用。解决方案资源管理器中没有系统文件夹!我正在使用visual studio 2012,我正在开发一个c#/ xaml metro app!
答案 0 :(得分:0)
好的,看起来地铁应用程序还不支持xsd!以下链接解释了这一点!
如果你有一个很深的xml结构,最后一个答案中的Perl脚本可用于删除[System.SerializableAttribute()]和[System.ComponentModel.DesignerCategoryAttribute(“code”)]注释!我没有,所以我只是手动删除它们!
我不确定删除这些注释是否会产生任何不良副作用。如果我面对任何问题,我会更新这个答案!
由于