【发布时间】:2012-12-03 02:21:32
【问题描述】:
使用 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 应用程序!
【问题讨论】:
-
您的应用程序中是否有一个名为
System的命名空间?例如,如果您在某处有using MyApplication.System,则System将解析为您的系统命名空间,而不是 mscorlib 系统命名空间。 -
我已经搜索了整个解决方案,没有名为 System! 的命名空间!我正在使用 listView 模板! xml、xsd 和生成的 c# 文件是我添加的唯一代码!
标签: c# xsd visual-studio-2012 microsoft-metro