【发布时间】:2022-01-03 05:32:44
【问题描述】:
我用 VS 2019 为 Visual Studio 制作了一个带有水晶报表的 c# 程序。在我的机器上一切正常。
我正在使用 Clickonce 在我的客户端中进行安装。但是我的客户遇到了这个错误:
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()
对于文件 log4net,我将应用程序文件中的发布状态更改为“包含”,但仍然出现相同的错误。
然后我在我的应用程序中安装了 log4net NuGet 包,重新进行了 clickonce 设置,但我仍然有同样的错误。
当我查看我的客户端计算机时,我看到 clickonce 安装应用程序的那个文件。
有解决这个问题的想法吗?
【问题讨论】:
标签: log4net