2

我有一个可以在 x86 上正常运行的程序。即使在 x64 上,它也可以在带有 Visual Studio 的系统上正常工作。但是在没有 Visual Studio 的 x64 系统上,调用报告时会出现错误。消息异常是:

The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception.
Source:
CrystalDecisions.CrystalReports.Engine
Stack Trace:
   at CrystalDecisions.CrystalReports.Engine.ReportDocument..ctor()
   at CrystalDecisions.CrystalReports.Engine.ReportClass..ctor()

和包含此描述的消息:

An error has occurred while attempting to load the Crystal Reports runtime.
Either the Crystal Reports registry key permissions are insufficient or the Crystal Reports runtime is not installed correctly.
Please install the appropriate Crystal Reports redistributable (CRRedist*.msi) containing the correct version of the Crystal Reports runtime (x86, x64, or Itanium) required.  Please go to http://www.businessobjects.com/support for more information.

我的程序基于:

  • .net 框架 4
  • 视觉工作室 2012
  • 水晶报告 13.0.2

有时安装 CRRuntime_64bit_13_0_2 。

谁能帮我?

4

1 回答 1

1

一种可能的解决方案

转到您的应用程序项目,右键单击,然后选择“属性”

在 Build 选项卡上,找到 Platform Target 组合框。它可能会说,“任何CPU”。

将此更改为 x86,您的项目将仅编译为 32 位,从而消除了该问题。

于 2012-10-23T12:42:37.520 回答