导出失败的原因是:无法加载一种或多种请求的类型。检索 LoaderExceptions 属性以获取更多信息。
每次我将代码发布到另一台服务器时,都会收到以下错误 导出失败的原因是:无法加载一种或多种请求的类型。检索 LoaderExceptions 属性以获取更多信息。
这非常令人沮丧,我已经检查并确保包含所有项目参考文件......任何帮助将不胜感激!
Everytime I publish my code to another server, I get the following error
Failed to export due to: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
This is very frustrating, I have already checked and made sure all the project reference files are included.... Any help would be appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在使用 AutoFac 时遇到了这个问题。基本上我有这行代码,并且得到了与您相同的错误:
异常没有告诉您任何信息!因此,您需要按照其说明合并“LoaderExceptions”。我想出了这个效果非常好的方法,并直接指出了缺少的 DLL:
现在,在异常中我得到了一堆有用的信息,但最重要的是我缺少的 DLL:“(Inner Exception #0) System. IO.FileNotFoundException:无法加载文件或程序集“System.Web.Mvc,Version=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35”或其之一系统找不到指定的文件。
文件名:'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'"
我发现System.Web.MVC被这个项目引用的一个项目引用了。所以这个项目并不直接需要但它的一个依赖项确实如此。
在您的代码中添加这样的 try/catch ,我想您会省去很多麻烦
。
I had this issue using AutoFac. Basically I had this line of code and was getting the same error as you:
The exception tells you nothing as you know! So you need to incorporate the "LoaderExceptions" as it says. I came up with this that works really well and pointed me straight away to the DLL that was missing:
Now in the exception I get a bunch of useful information but most importantly the DLL I was missing: "(Inner Exception #0) System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'"
I found that System.Web.MVC was referenced by a project that this project referenced. So this project did not directly need it but one of it's dependencies did.
Put a try/catch like that around your code and I think you will save yourself a lot of pain.
Cheers.
我在 Autofac Build() 周围使用 nootn 的 try catch 代码并收到以下错误,
这是因为我使用的是 MVC4 VS2012 模板,并且默认情况下 EntityFramework 引用默认指向 EF 5 rc。因此,我
Uninstall-package EntityFramework
,然后Install-package EntityFramework
安装 EF4.3。现在正在工作。谢谢你。I use the nootn's try catch code around the Autofac Build() and got the following error,
This was because I was using MVC4 VS2012 template and by default the EntityFramework reference was pointing to EF 5 rc by default. So I
Uninstall-package EntityFramework
and thenInstall-package EntityFramework
which install EF4.3. It's working now. Thank you nootn.