Failed to load file or assembly "Microsoft.Practices.EnterpriseLibrary.Common" or one of its dependencies

I searched Google for this and could not find a solution to the problem.

My site references DAL (user dll), which refers to data access components for corporate libraries.

I added the corporate library from the NuGet Package Manager , and when I try to create a site, this compilation error appears:

Error 44 Failed to load the file or assembly "Microsoft.Practices.EnterpriseLibrary.Common" or one of its dependencies. The located assembly manifest definition does not match the reference

I tried setting Copy Local = True to DAL for the Enterprise Library dlls , and the dlls were transferred to the Bin directory of the website along with the DAL dll , but the error still appears.

Can anyone visit me on this ....

+10
c # nuget enterprise-library nuget-package
Dec 08 '11 at 12:48
source share
6 answers

The problem is that the DLL you are using and the one that is specified in your project are different. I'm not sure what the difference is in the manifest, but it could be the version and / or public key.

You have a few things to try:

  • Open the properties for the DLL link in your project and set the Version Specific parameter to false.

  • Remove the link, remove the DLL from the bin folder, and re-add the link.

  • Your GAC may also have a different / incorrect version. To make sure that you always use a certain known version, create an assembly folder relative to your project directory, copy the dll to this directory and add the link to the DLL in the assembly directory, not in the GAC or elsewhere. on your car. This ensures that only the specific version for which you were targeting the application will be used, and not any version updated later on your computer.

+8
Dec 08 '11 at 6:43 on
source share

NuGet CommonServiceLocator

 Install-Package CommonServiceLocator 
+4
Oct 23 '13 at 3:36
source share

This DLL is likely to be in the GAC on development machines as part of some installation of Windows applications (my best guess is Visual Studio or SSMS). This is why we are likely to receive warnings or errors on the build machine that we are trying to make the GAC clean, like production servers.

To download the file manually, you can go to https://servicelocation.codeplex.com/

To fix warnings and build errors, you just need to run the NuGet command to install the CommonServiceLocation package . A package contains only one DLL file. Microsoft has released only 1 version (1.0.0.0) of this file since 2008. The file is fully compatible with all versions of .NET and all versions of Unity.

+2
Sep 08 '14 at
source share

Thanks for this info.

I have the same problem, I upgraded Framework from 2.0 to 4.0, I tried everything you mentioned, but the solution was to set PublicKeyToken values ​​for each EnterpriseLibrary link in the Web.Config file

0
Dec 23 '15 at 17:02
source share

Same problem! I just cleaned the assembly and restored the project. So, all the old things are gone and the versions are fixed. Solvable.

0
Jan 15 '16 at 6:14
source share

I managed to solve this problem by removing from ALL logging links in the app.config file ::

 , Version=6.0.0.0, Culture=neutral, PublicKeyToken=null 

t

  <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null" requirePermission="true" /> 

becomes:

  <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging" requirePermission="true" /> 

It is not perfect, but it works ...

The corporate library configuration tool sets the values ​​back, so you need to keep track of this. I know that there is a way to tell the configuration file to accept these incorrectly configured parameters, but I'm not sure how to do this.

0
Apr 04 '17 at 19:34 on
source share



All Articles