当前位置:  开发笔记 > 编程语言 > 正文

mscorlib.XmlSerializers.DLL的FileNotFoundException,它不存在

如何解决《mscorlib.XmlSerializers.DLL的FileNotFoundException,它不存在》经验,为你挑选了0个好方法。

我正在使用XmlSerializer来反序列化mscorelib.dll中的特定类型

XmlSerializer ser = new XmlSerializer( typeof( [.Net type in System] ) );
return ([.Net type in System]) ser.Deserialize( new StringReader( xmlValue ) );

这会FileNotFoundException在加载程序集时抛出一个catch :

"无法加载文件或程序集'mscorlib.XmlSerializers,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'或其中一个依赖项.系统找不到指定的文件."

FusionLog:

=== Pre-bind state information ===
LOG: User = ###
LOG: DisplayName = mscorlib.XmlSerializers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=x86
 (Fully-specified)
LOG: Appbase = file:///C:/localdir
LOG: Initial PrivatePath = NULL
Calling assembly : System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\localdir\bin\Debug\appname.vshost.exe.Config
LOG: Using machine configuration file from c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: mscorlib.XmlSerializers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=x86
LOG: Attempting download of new URL file:///C:/localdir/bin/Debug/mscorlib.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///C:/localdir/bin/Debug/mscorlib.XmlSerializers/mscorlib.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///C:/localdir/bin/Debug/mscorlib.XmlSerializers.EXE.
LOG: Attempting download of new URL file:///C:/localdir/bin/Debug/mscorlib.XmlSerializers/mscorlib.XmlSerializers.EXE.

据我所知,没有mscorlib.XmlSerializers.DLL,我认为.Net的自动生成的DLL名称正在寻找序列化程序.

在编译优化序列化时,您可以选择创建myApplication.XmlSerializers.DLL,因此我认为这是框架检查它的一部分.

问题是,这似乎导致加载应用程序的延迟 - 此时似乎挂起了几秒钟.

任何想法如何避免或加快它?

推荐阅读
刘美娥94662
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有