c# - "The type or namespace name ' 引用System.Xml.dll时XmlSerializer ' could not be found"错误

标签 c# visual-studio-2010 silverlight-4.0 xmlserializer

我已经在这上面浪费了几个小时:

XmlSerializer serializer;

是的,using 在那里,引用在那里,我在 VS2010 中使用 .NET 4.0 制作了整个解决方案,所以它不是那些东西。如果我进入对象资源管理器,我可以在正确的命名空间中找到我想要的 XmlSerializer 类,但是如果我尝试在我的代码文件中键入上面的行并进行编译,我会得到可怕的

The type or namespace name 'XmlSerializer' could not be found (are you missing a using directive or an assembly reference?)

死亡警告。我也没有在 IntelliSense 上得到它。我查看过的所有其他线程/网站都是空白的,或者是我已经排除的解决方案之一。我错过了什么? 干杯

最佳答案

您会构建 Silverlight 应用程序吗?
Silverlight 有 XmlSerializer definedSystem.Xml.Serialization.dll 程序集中,默认情况下不被引用。
这通常会导致混淆,因为其他框架版本在 System.Xml.dll 中定义了它。

您需要将 System.Xml.Serialization.dll 添加到项目引用以将其连接起来。

关于c# - "The type or namespace name ' 引用System.Xml.dll时XmlSerializer ' could not be found"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4910475/

相关文章:

silverlight - 如何使用silverlight 4在点击事件中定位弹出窗口?

c# - Silverlight 和双工 WCF 服务

c# - AnyCpu 和 x86 之间的执行时间差异很大

c# - SQL Server Compact 与 C# 数据结构的比较

c# - 如何自动隐藏表单

c# - 如何在 SonarQube 中排除项目特定文件

c# - 从头开始——我应该使用 (MS Visual Studio) C# 还是 (MS Visual Studio) C++?

c++ - 在调试器中的函数评估期间中断

javascript - 银光4 : OnBeforeUnload

asp.net - 修改 FormView 的默认模板