Jose Melendez

Jose Melendez

  • NA
  • 54
  • 4.2k

Error with crystal report in my c# app...

Nov 24 2021 8:21 PM

Hello,

I made a c# program with VS 2019 with crystal report for visual studio.  All works well in my machine.

I'm installing in my client with Clickonce.  But I having a problem in my client with this error:

 

System.TypeInitializationException: The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception. ---> 
System.TypeInitializationException: The type initializer for 'CrystalDecisions.Shared.SharedUtils' threw an exception. ---> 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)
   at CrystalDecisions.Shared.SharedUtils..cctor()
   --- End of inner exception stack trace ---
   at CrystalDecisions.Shared.SharedUtils.get_CurrentControl()
   at CrystalDecisions.Shared.SharedUtils.GetEffectiveCulture()
   at CrystalDecisions.CrystalReports.Engine.CREngineRes.GetString(String name)
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.CheckForCrystalReportsRuntime()
   at CrystalDecisions.CrystalReports.Engine.ReportDocument..cctor()
   --- End of inner exception stack trace ---
   at CrystalDecisions.CrystalReports.Engine.ReportDocument..ctor()
   at PatientTrackingSystem.MainWindow.<PrintReportAsync>d__143.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at PatientTrackingSystem.MainWindow.<cmdPrintRouteSlip_Click>d__144.MoveNext()

 


For the file log4net, I changed the publish Status in the Application Files  to "Include" but I still have the same error.

Then I installed  the log4net NuGet Package in my application, remade the clickonce setup, and I still have the same error.

When I look in the my client machine, I see that file where clickonce install the application.

Any idea to fix that issue?


Answers (1)