Could not load file or assembly #39;Microsoft.Practices.EnterpriseLibrary.Common#39; or one of its dependencies(无法加载文件或程序集“Microsoft.Practices.EnterpriseLibrary.Common或其依赖项之一)
问题描述
我已经在 google 上搜索过,但找不到问题的解决方案.
I have searched google for this and could not find the solution to the problem.
我的网站引用了引用企业库数据访问组件的 DAL(自定义 dll).
My Website references DAL (custom dll) which references Enterprise Library Data Access Components.
我已从 NuGet 包管理器
添加了企业库,当我尝试构建网站时,会弹出此编译错误:
I have added the Enterprise Library from the NuGet Package Manager
and when I try to build the Website this compilation error pops up:
错误 44 无法加载文件或程序集Microsoft.Practices.EnterpriseLibrary.Common"或其依赖项之一.找到的程序集的清单定义与程序集引用不匹配
Error 44 Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference
我已尝试在 DAL 中为 Enterprise Library dlls
设置 Copy Local = True
,并且 dll 与 一起转移到网站的 Bin 目录>DAL dll
,但还是会弹出错误.
I have tried setting the Copy Local = True
in the DAL for the Enterprise Library dlls
and the dlls are transferred to the Bin directory of the website along with DAL dll
, but still the error pops up.
谁能指导我这个....
Can anyone guide me on this....
推荐答案
问题是你使用的DLL和你项目中引用的DLL不同.我不确定清单中有什么区别,但可能是版本和/或公钥.
The problem is that the DLL that you are using and the one that is referenced in your project are different. I'm not sure what the difference in the manifest is, but it could be version and/or public key.
你有几件事要尝试:
在项目中打开 DLL 引用的属性并将 Version Specific 设置为 false.
Open the properties for the DLL reference in your project and set Version Specific to false.
删除引用,从bin文件夹中删除DLL,重新添加引用.
Remove the reference, delete the DLL from the bin folder, and re-add the reference.
您的 GAC 中也可能有不同/不正确的版本.为了确保您始终使用特定的已知版本,请创建一个相对于您的项目目录的程序集文件夹,将 dll 复制到该目录,并在程序集目录中添加对 DLL 的引用,而不是在 GAC 或其他地方添加对 DLL 的引用在你的机器上.这将确保仅使用您为应用程序指定的特定版本,而不是稍后在您的计算机上更新的任何版本.
You could also have a different/incorrect version in your GAC. In order to make sure that you are always using a specific, known version create an assemblies folder relative to your project directory, copy the dll to that directory, and add a reference to the DLL in the assemblies directory rather than one in GAC or elsewhere on your machine. This will ensure that only the specific version that you have targeted for the application will be used rather than any version that is updated on your machine at a later time.
这篇关于无法加载文件或程序集“Microsoft.Practices.EnterpriseLibrary.Common"或其依赖项之一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:无法加载文件或程序集“Microsoft.Practices.EnterpriseLibrary.Common"或其依赖项之一
基础教程推荐
- c# Math.Sqrt 实现 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- rabbitmq 的 REST API 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01