Report works on development PC but throws exceptio

2019-08-23 14:40发布

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.

2条回答
干净又极端
2楼-- · 2019-08-23 14:56

Runtime Crystal Report will call that DLL to create the report.

This is what happened to me, I run on win 10 - 64 bit, and use old application.

Error appeared on app :

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.

I have tried to install CRRedist2005_X64.msi, but the error is still occured, but saying something different. I have tried to install newer version, but it is useless.

You need to install this :

CRRedist2005_x86.msi

Make sure the version of dll file.

CrystalDecisions.ReportAppServer.CommLayer, Version=10.2.3600.0

is for CR2005. Maybe higher version is for newer CR version.

查看更多
Luminary・发光体
3楼-- · 2019-08-23 15:13

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

查看更多
登录 后发表回答