我正在尝试使用以下代码序列化“ 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.
在这里我可能做错了什么?
谢谢。
答案 0 :(得分:0)
在另一篇文章中,我读到这是正常现象,可以通过取消选中“在此异常时引发错误”来忽略它。 虽然不漂亮,但是截至2018年似乎还没有任何解决方法。