Search code examples
c#.netcrystal-reports

Report works on development PC but throws exception on the PC where it's deployed (CrystalDecisions.CrystalReports.Engine.ReportDocument)


I developed an application with Crystal Reports, when i test the project on the development PC it works, but it gives an exception on the customer PC

The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception.

also the project was developed Using VS 2010 then it completed with VS 2008,so I am developing using VS 2008 now, I'm not sure if this Could Cause the problem, and about the Setup Project i make a reference to the following DLLs:

-CrystalDecisions.CrystalReports.Engine.dll
-CrystalDecisions.ReportSource.dll
-CrystalDecisions.Shared.dll
-CrystalDecisions.Web.dll
-CrystalDecisions.Windows.Forms.dll

All DLLs have the same version number :10.2.3600.0

And i install the setup without installing anything else then .net Framework 3.5, (Do i have to install a runtime Crystal Report engine and if have to which version to install? ).

Exception Details:

System.TypeInitializationException: The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'CrystalDecisions.ReportAppServer.CommLayer, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified. File name: 'CrystalDecisions.ReportAppServer.CommLayer, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' at CrystalDecisions.CrystalReports.Engine.ReportDocument..cctor()

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Thanks in advance for any Help.


Solution

  • On the client's machine you need to install the Crystal Runtime for your version. Normally if you are using VS2008 you need to install Crystal Reports 2008 Runtime Package for the .NET Framework (recommended), or embed the Merge Modules for Crystal Reports 2008 Runtime into your own setup (not recommended). From here: http://resources.businessobjects.com/support/additional_downloads/runtime.asp#08 That will install Crystal Report's assemblies needed on the client. Have you done that already?

    If after that you still have problems, you need to verify that the Crystal.*.dll has the same version than the ones installed on the client's machine.

    If you want to use specific version of the crystal assemblies on the properties of those assemblies change the Specific Version to True in the Properties within VS

    Finally, check if you are missing a Crystal SP/HotFix which makes the assemblies version differ http://wiki.sdn.sap.com/wiki/display/BOBJ/Crystal+Reports+2008+-+Version+and+Download+information+for+SPs+and+FPs