Getting runtime System.IO.FileLoadException for Microsoft.Practices.EnterpriseLibrary.Data

0

I just copied the source code for a project from source control. The project compiles successfully, but I get a runtime error during execution when it executes the below line of code.

public static LogWriter logger = EnterpriseLibraryContainer.Current.GetInstance<LogWriter>();

Below is the error: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

Below is the FusionLog for the error: Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Running under executable D:\Workspace\XXXX_XXXX --- A detailed error log follows. === Pre-bind state information === LOG: DisplayName = Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 (Fully-specified) LOG: Appbase = file:///D:/Workspace/XXXX_XXXX LOG: Initial PrivatePath = NULL

Calling assembly : Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.

LOG: This bind starts in default load context. LOG: Using application configuration file: D:\Workspace\XXXX_XXXX LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Post-policy reference: Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 LOG: Attempting download of new URL file:///D:/Workspace/XXXX_XXXX/obj/x86/Debug/Microsoft.Practices.EnterpriseLibrary.Data.DLL. WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

I have checked the project references and dll versions and all those seem to be correct. All the reference dlls and dependent dlls are present in the bin directory,still I get the error. From what I understood by looking at similar posts, this issue is related to dependent assembly binding. I tried some of the work arounds, but still don't know what I am missing. Please guide me in pointing out the specific issue and suggest a work around.

.net
dll
asked on Stack Overflow Mar 15, 2019 by Nik

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0