Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
DEAR ALL,

I have created a new project and in which i have added the other recent projects.

And I installed NuGet package "Log4Net". Which is also used in other added projects, where its throws the compilation error.

 Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
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.IO.FileLoadException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Source Error:


Line 122:				}
Line 123:			}
Line 124:		}
Line 125:
Line 126:		#endregion


Source File: C:\TETEC\Development\TeTec.Utility\LogHelper\LogHelper.cs    Line: 124

Assembly Load Trace: The following information can be helpful to determine why the assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' could not be loaded.


WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].


Stack Trace:


[FileLoadException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]

[FileLoadException: Could not load file or assembly 'log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
   TeTec.Utility.LogHelper.LogHelper.Log(Logger logger, LogLevel level, String message, Exception exception) in C:\TETEC\Development\TeTec.Utility\LogHelper\LogHelper.cs:124
   TeTec.Utility.LogHelper.LogHelper.Log(Logger logger, LogLevel level, String message) in C:\TETEC\Development\TeTec.Utility\LogHelper\LogHelper.cs:62
   Module.TeTecHttpModule.InternalInit() in c:\TETEC\Development\TeTec.Online.ExamWebsite\App_Code\Module\TeTecHttpModule.cs:31
   Module.TeTecHttpModule.Init(HttpApplication context) in c:\TETEC\Development\TeTec.Online.ExamWebsite\App_Code\Module\TeTecHttpModule.cs:61
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +536
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +173
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Could not load file or assembly 'log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +10085804
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +95
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254


What I have tried:

So, in web.config i have added these lines.

<runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
              <assemblyIdentity name="log4net" publicKeyToken="1b44e1d426115821" culture="neutral" />
              <bindingRedirect oldVersion="1.2.10.0" newVersion="2.0.8.0"/>
          </dependentAssembly>
      </assemblyBinding>
  </runtime>



Can anyone please help me.


Thanks in advance.
Posted
Comments
F-ES Sitecore 9-Dec-17 13:53pm    
Is the log4net assembly in the bin folder? If so what version is it?
BulletVictim 12-Dec-17 7:50am    
Quite simple, you will need to update the Log4Net package in the previously compiled solutions that you have added to the new solution.
Alternatively just reference the Log4Net Dll from the packages location in one of the previous solutions. Might not have the Nuget functionality, but should solve your problem.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900