相关疑难解决方法(0)

XmlSerializer在构造函数中给出FileNotFoundException

当我尝试序列化类型时,我一直在使用的应用程序失败.

像这样的陈述

XmlSerializer lizer = new XmlSerializer(typeof(MyType));
Run Code Online (Sandbox Code Playgroud)

生产:

System.IO.FileNotFoundException occurred
  Message="Could not load file or assembly '[Containing Assembly of MyType].XmlSerializers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."
  Source="mscorlib"
  FileName="[Containing Assembly of MyType].XmlSerializers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
  FusionLog=""
  StackTrace:
       at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
       at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
Run Code Online (Sandbox Code Playgroud)

我没有为我的班级定义任何特殊的序列化器.

我该如何解决这个问题?

c# xml-serialization

340
推荐指数
9
解决办法
12万
查看次数

标签 统计

c# ×1

xml-serialization ×1