Crystal 报告的 ReportDocument 抛出错误

ReportDocument of Crystal Report is throwing error

Crystal Reports dll 的当前版本是 13.0.20

1  private void LandingPermitVesselReceipt(string[] VesselDetail, Boolean IsBulkVessel)
2   {
3        ReportDocument Rpt = null;
4
5        try
6        {
7           Rpt = new ReportDocument();
8            
9           Vessel DAL_REPORT = new Vessel();

在第 7 行出现错误。 当我尝试查看 Crystal 报告时,出现此错误

Could not load file or assembly 'CrystalDecisions.ReportAppServer.CommLayer, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.

添加 CrystalDecisions.ReportAppServer.CommLayer.dll 后,出现此错误:

Could not load file or assembly 'CrystalDecisions.ReportAppServer.CommLayer' or one of its dependencies. An attempt was made to load a program with an incorrect format.

如果有人遇到这个问题,请告诉我。

对于这个错误,我添加了 comm layer.dll 但它仍然在起始页上抛出了其他 dll 错误。 只要反编译软件你也可以看到dll的构建和版本。 我的 Crystal Report.Engine dll 有 AnyCPU 配置构建,而 commlayer.dll 有 x64 构建。

因此出现错误格式错误。

在我添加 Anycpu 构建类型 Commlayer.dll 之后,这个问题就解决了。