I've gone through another questions here and here but seems that I still could not solve this problem. Even when I try to remove the reference 'log4net' from my program, when I run it still gives the same error. Any ideas?
OS used : Win 7-64 bit.
IDE : Visual Studio 2015
Could not load file or assembly 'log4net' or one of its dependencies. An attempt was made to load a program with an incorrect format. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.BadImageFormatException: Could not load file or assembly 'log4net' or one of its dependencies. An attempt was made to load a program with an incorrect format. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Assembly Load Trace: The following information can be helpful to determine why the assembly 'log4net' could not be loaded. === Pre-bind state information === LOG: DisplayName = log4net (Partial) WRN: Partial binding information was supplied for an assembly: WRN: Assembly Name: log4net | Domain ID: 10 WRN: A partial bind occurs when only part of the assembly display name is provided. WRN: This might result in the binder loading an incorrect assembly. WRN: It is recommended to provide a fully specified textual identity for the assembly, WRN: that consists of the simple name, version, culture, and public key token. WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue. LOG: Appbase = file:///D:/Codes/Apps/Apps/ LOG: Initial PrivatePath = D:\Codes\Apps\Apps\bin Calling assembly : (Unknown). === LOG: This bind starts in default load context. LOG: Using application configuration file: D:\Codes\Apps\Apps\web.config LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/Apps/6694390a/8e1278d/log4net.DLL. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/Apps/6694390a/8e1278d/log4net/log4net.DLL. LOG: Attempting download of new URL file:///D:/Codes/Apps/Apps/bin/log4net.DLL. ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
I would like a solution where it will allow me to use
log4net, instead of just removing it completely.
[UPDATE 1]: I tried to use the log4net from
And it seems to work. But I don't understand why. My other projects are using from
C:\Windows\assembly\GAC_64\log4net\126.96.36.199__692fbea5521e1304\log4net.dll and it still work. Anyone knows the difference in the project setting that will make using the
Ist log4net still located in your bin folder? It could be as easy as deleting the dll from there (after removing it from your code).
Sometimes you also habe to clean the temporary asp.net folder (c:\windows\Microsoft.NET\Frameword\v4.0.30319\Temporary ASP.NET Files).
If this does not help another package is probably dependent on log4net. Then you have to identify this package and also remove it if you want to get rid of log4net.
User contributions licensed under CC BY-SA 3.0