I am working on a .NET Framework 4.8 project. Previously it was designed for .NET Framework 3 and Visual Studio 2008. During this upgrade, I installed the latest version of Crystal Reports and Visual Studio because it was giving issue on old version of Crystal Reports in Visual Studio 2022. Now it’s showing new error that log4net is not loading but I checked I can see that file.
These are the errors:
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' 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=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source Error:
Line 13: <div style="width:55%">
Line 14:
Line 15: <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server"
Line 16: AutoDataBind="true" />
Line 17: <CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
Source File: d:xxxxxxxxReportsShowReport.aspx Line: 15
Assembly Load Trace: The following information can be helpful to determine why the assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' could not be loaded.
Assembly manager loaded from: C:WindowsMicrosoft.NETFramework64v4.0.30319clr.dll
Running under executable C:Program FilesIIS Expressiisexpress.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304
(Fully-specified)
LOG: Appbase = file:///D:/xxxxx/xxxx/
LOG: Initial PrivatePath = D:xxxxxxxxxxbin
Calling assembly : CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:xxxxxxxxweb.config
LOG: Using host configuration file: C:UsersxxxxDocumentsIISExpressconfigaspnet.config
LOG: Using machine configuration file from C:WindowsMicrosoft.NETFramework64v4.0.30319configmachine.config.
LOG: Post-policy reference: log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304
LOG: Attempting download of new URL file:///C:/Users/xxxxx/AppData/Local/Temp/Temporary ASP.NET Files/vs/96a8c422/6d872058/log4net.DLL.
LOG: Attempting download of new URL file:///C:/Users/xxxxx/AppData/Local/Temp/Temporary ASP.NET Files/vs/96a8c422/6d872058/log4net/log4net.DLL.
LOG: Attempting download of new URL file:///D:/xxxxx/xxxx/bin/log4net.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Stack Trace:
[FileLoadException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
CrystalDecisions.Web.CrystalReportViewer..cctor() +0
[TypeInitializationException: The type initializer for 'CrystalDecisions.Web.CrystalReportViewer' threw an exception.]
CrystalDecisions.Web.CrystalReportViewer..ctor() +0
ASP.reports_showreport_aspx.__BuildControlCrystalReportViewer1() in d:xxxxxxxxxxReportsShowReport.aspx:15
ASP.reports_showreport_aspx.__BuildControlform1() in d:xxxxxxxxReportsShowReport.aspx:12
ASP.reports_showreport_aspx.__BuildControlTree(reports_showreport_aspx __ctrl) in d:Ascent-SCMSMART.WebsiteReportsShowReport.aspx:1
ASP.reports_showreport_aspx.FrameworkInitialize() in c:UsersxxxAppDataLocalTempTemporary ASP.NET Filesvs96a8c4226d872058App_Web_ieb0u1kl.1.cs:0
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +52
System.Web.UI.Page.ProcessRequest() +79
System.Web.UI.Page.ProcessRequest(HttpContext context) +74
ASP.reports_showreport_aspx.ProcessRequest(HttpContext context) in c:UsersxxxxAppDataLocalTempTemporary ASP.NET Filesvs96a8c4226d872058App_Web_ieb0u1kl.1.cs:0
System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +2153
[HttpException (0x80004005): Error executing child request for /Reports/ShowReport.aspx.]
System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, yStringOveVirtualPath path, VirtualPath filePath, String physPath, Exception error, String querrride) +2414
System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm) +848
System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm) +74
SMART.Website.Reports.Search.RequirementSearch.ShowDetailsOfPO() in D:xxxxxxxReportsSearchRequirementSearch.aspx.cs:297
SMART.Website.Reports.Search.RequirementSearch.po_content_Click(Object sender, CommandEventArgs e) in D:xxxxxxReportsSearchRequirementSearch.aspx.cs:283
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +139
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1959
I tried to overcome this error almost in every aspect. I saw solution in this platform and tried but didn’t get any success. I updated log4net into 2.0.17.0
Following solution that I tried so far.
-
Update log4net and then clean solution and rebuild, but same error.
-
Set binding redirect in web.config from log4net 1.2.10.0 to log4net 2.0.17.0. still same issue.
-
Set location of folder in web.config like this:
<code><dependentAssembly><assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" /><codeBase version="2.0.17.0" href="D:xxxxxxxxbinDebuglog4net.dll" /></dependentAssembly></code><code><dependentAssembly> <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" /> <codeBase version="2.0.17.0" href="D:xxxxxxxxbinDebuglog4net.dll" /> </dependentAssembly> </code><dependentAssembly> <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" /> <codeBase version="2.0.17.0" href="D:xxxxxxxxbinDebuglog4net.dll" /> </dependentAssembly>
But the same error happens, nothing has changed.
-
Change CPU setting into x86 or x64 and then clean solution and rebuild. In both cases also same error occurred.
I am not sure what else I need to do to resolve this error. It looks like I have to do it again from scratch.
Any help will be appreciated to resolve this issue.
Thanks
1