无法加载 MyAssembly.XmlSerializers.dll.该系统找不到指定的文件 [英] Could not load MyAssembly.XmlSerializers.dll. The system cannot find the file specified

查看:36
本文介绍了无法加载 MyAssembly.XmlSerializers.dll.该系统找不到指定的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近安装了 Visual Studio 2012.

I have recently installed Visual Studio 2012.

但是,安装后,之前在 Visual Studio 2010 中正常工作的项目开始抛出以下错误并崩溃:

However, after the installation, a project that was previously working correctly in Visual Studio 2010 began throwing and crashing on the following error:

'System.TypeInitializationException:'MyType' 的类型初始值设定项抛出异常.---> System.IO.FileNotFoundException: 无法加载文件或程序集MyAssembly.XmlSerializers"或其之一依赖关系.系统找不到指定的文件.

'System.TypeInitializationException: The type initializer for 'MyType' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'MyAssembly.XmlSerializers' or one of its dependencies. The system cannot find the file specified.

在 System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName,字符串代码库、证据程序集安全性、运行时程序集locationHint、StackCrawlMark&stackMark,IntPtr pPrivHostBinder,布尔值 throwOnFileNotFound、布尔值用于内省、布尔值抑制安全检查)

at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

在 System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName,字符串代码库、证据程序集安全性、运行时程序集locationHint、StackCrawlMark&stackMark,IntPtr pPrivHostBinder,布尔值 throwOnFileNotFound、布尔值用于内省、布尔值抑制安全检查)

at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

没有将项目升级到 VS2012,我像以前一样在 VS2010 中运行它.我没有对项目本身进行任何更改.唯一的变化是我在机器上安装了 VS2012(和 .NET 4.5).

I did not upgrade the project to VS2012, I am running it out of VS2010 as before. I have not made any changes to the project itself. The only change was that I installed VS2012 (and .NET 4.5) on the machine.

是什么导致了这个意外问题?

What could be causing this unexpected problem?

推荐答案

情况比我预想的要棘手一些.该程序集的 XMLSerializers DLL 似乎对我的解决方案中的身份验证至关重要,并且只是按 [ing] F5 继续运行直到真正的问题发生"并没有导致一些不相关的错误.

The situation was a little trickier than I had expected. The XMLSerializers DLL for that assembly seems to be essential for authentication in my solution, and just "Press[ing] F5 to continue running until the real problem occurs" did not lead to some unrelated error.

我一直无法完全理解根本问题是什么,但似乎在 Visual Studio 升级后动态创建 DLL 出现问题.

I have not been able to completely understand what the underlying issue is, but it seems that there is a problem creating the DLL dynamically after Visual Studio is upgraded.

我解决这个问题的方法是运行 sgen 工具来手动创建序列化程序并将生成序列化程序集"标志设置为关闭.通过添加构建后指令来运行该工具,该过程可以自动化.

The way I have worked around the issue is by running the sgen tool to manually create the serializers and setting the flag "Generate Serialization Assemblies" to Off. The process can be automated by adding a post-build instruction to run the tool.

话虽如此,我不知道为什么会首先出现这个问题,因为我确定我没有在 VS2012 中打开该项目.

That being said, I have no idea why this issue comes up in the first place, as I am certain that I did not open the project in VS2012.

这篇关于无法加载 MyAssembly.XmlSerializers.dll.该系统找不到指定的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆