FileNotFoundException for mscorlib.XmlSerializers.DLL, which doesn't exist

后端 未结 3 990
难免孤独
难免孤独 2020-12-31 09:00

I\'m using an XmlSerializer to deserialize a particular type in mscorelib.dll

XmlSerializer ser = new XmlSerializer( typeof( [.Net type in System] ) );
retur         


        
3条回答
  •  感情败类
    2020-12-31 09:41

    Okay, so I ran into this problem and have found a solution for it specific to my area.

    This occurred because I was trying to serialize a list into an XML document (file) without an XML root attribute. Once I added the following files, the error goes away.

    XmlRootAttribute rootAttribute = new XmlRootAttribute();
    rootAttribute.ElementName = "SomeRootName";
    rootAttribute.IsNullable = true;
    

    Dunno if it'll fix your problem, but it fixed mine.

提交回复
热议问题