第三方dll在ASP.NET MVC项目中找不到其依赖项 [英] Third party dll can't find its dependencies in ASP.NET MVC project
问题描述
我在项目中使用了第三方库.像MainLibNET.dll
这样称呼它.我将此库添加到了项目的References
中.该dll与其他dll具有依赖关系.我无法在References
中添加此其他dll,因为它们是本机的.我将其他库放在\bin
中,但是当我启动项目时出现错误:
I use third party library in my project. Call it like MainLibNET.dll
. I added this library in References
of my project. This dll has dependencies with other dlls. This other dlls I can't add in References
because they are native. I put this other libraries in \bin
but when I start my project I get error:
Could not load file or assembly 'MainLibNET.dll' or one of its dependencies
MainLibNET.dll找不到其依赖项,因为在站点启动时,服务器不是从\bin
而是从此处返回MainLibNET.dll:
MainLibNET.dll can't find its dependencies because when site starts the server returns MainLibNET.dll not from \bin
but from here:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\e9b9d054\ddfaf4f8\assembly\dl3\8e683e03\00c3703b_919bcb01\MainLibNET.dll
,除MainLibNET.dll外,此文件夹中没有其他文件.如果我将其他dll复制到此文件夹中,则可以正常工作.
and there are no other files in this folder except MainLibNET.dll. If I copy other dlls in this folder it works fine.
我该如何处理我的项目或进行其他任何操作以使我的项目无需人工复制?
What can I do with my project or with anything else to make my project work without hand-copying?
推荐答案
托管程序集获得由ASP.NET复制的影子.此过程不包括非托管库,这解释了为什么无法解决它们.一种可能性是将这些本机库添加到c:\windows\System32\Inetsrv
文件夹中.另一种可能性是将它们放入PATH
环境变量的一部分的文件夹中.
Managed assemblies get shadow copied by ASP.NET. This process doesn't include unmanaged libraries which explains why they cannot be resolved. One possibility is to add those native libraries into the c:\windows\System32\Inetsrv
folder. Another possibility is to put them into a folder which is part of the PATH
environment variable.
这篇关于第三方dll在ASP.NET MVC项目中找不到其依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!