【问题标题】:XmlSerializers raises BindingFailureXmlSerializers 引发 BindingFailure
【发布时间】:2018-08-26 16:48:53
【问题描述】:

我正在尝试使用此代码序列化“PrinterSettings”:

Private Sub pAddEditPrinterSettings(ByVal uPrinterSettings As PrinterSettings)

    Dim s As String = String.Empty

    Dim nXSer As New Xml.Serialization.XmlSerializer(uPrinterSettings.GetType())
    Using sw As New StringWriter
        nXSer.Serialize(sw, uPrinterSettings)
        s = sw.ToString()
    End Using

但是,“nXSer As New ...”行失败并出现错误

BindingFailure: The assembly with the name "System.Drawing.XmlSerializers" wasn't found in the LoadFrom binding contexts of AppDomain with ID 1. Cause: System.IO.FileNotFoundException: The file or assembly "SystemDrawing.XmlSerializers, Version=4.0.0.0,Culture=neutral,PublicKeyToken b03f5f7f11d50a3a or a dependency wasn't found. The system couldn't find the file.

我在这里可能做错了什么?

谢谢。

【问题讨论】:

    标签: xml vb.net serialization dll


    【解决方案1】:

    在另一篇文章中,我读到这是正常的,可以通过取消选中“在此异常处引发错误”来忽略。 不漂亮,但截至 2018 年似乎没有任何解决方法。

    【讨论】:

    • 仅供参考,您可以在最初的问题下创建评论,或者编辑您的问题而不是编写新答案。
    猜你喜欢
    • 1970-01-01
    • 2015-09-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-15
    • 2011-04-07
    • 2015-04-18
    • 2011-07-25
    相关资源
    最近更新 更多