Crystal Report Error – Could not load file or assembly ‘CrystalDecisions.CrystalReports.Engine’

We have few users that use our Crystal Report on our hosting environment that encounter this error. In this article, we will advise steps to fix this error message

Error Message

Configuration Error

Parser Error Message: Could not load file or assembly ‘CrystalDecisions.Web, Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692fbea5521e1304’ or one of its dependencies. The system cannot find the file specified.

Source Error:

An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Source File: C:\TestReport\web.config Line: 29

Assembly Load Trace: The following information can be helpful to determine why the assembly ‘CrystalDecisions.Web, Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692fbea5521e1304’ could not be loaded.

How to Fix the Error Message

The error can be happened because the Crystal Report version is different with what you installed on the server or you haven’t installed Crystal Report on server.

1. First thing to do is you need to make sure that Crystal Report runtime is installed on your machine on server and which version do you have.

For development machine, you need the SDK intalled for Visual Studio. For 64 bit machine, you need the 64 bit SDK installation for development purpose. You can find the download link on the following page:

https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads

For server, you need to install the runtime instead. For 64 bit machine, you need the 64 bit runtime installation.

2. Check what Crystal Reports dll version was installed on your development machine. You can check it on C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0

As you can see that now I have both win32_x86 and win64_x64 folders which means I have 64 bit installed on top of the 32 bit one.

Now, by default the installation will also put the dlls in the Global Assembly Cache (GAC). So on your production server, the code will reference the one in the GAC.

Here, you can see the version I had installed now is 13.0.3500.0 which is the version I want. Make sure that the version has same version

So I then try several things that didn’t prove to fix the issue.

  • I right click on the dll reference in the project and choose Properties. Then, I make sure the following: Copy Local – False, Embed Interop Types – False, Specific Version – False

I thought maybe it was copying the wrong dll files but at the end it didn’t matter when I deploy it. It still didn’t work.

For your information, my production environment is setup so that the Crystal report dll files are not deployed to the bin folder. Hence, it will use what is in GAC. But what I couldn’t figure out is that how does it reference which version dll.

Solution

To fix it, just put a hard assembly reference to your web config under compilation

 <compilation defaultLanguage="vb" debug="true" targetFramework="4.7.2">
      <assemblies>
<add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />
        <add assembly="CrystalDecisions.ReportSource, Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />
        <add assembly="CrystalDecisions.Shared, Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />
      </assemblies>
    </compilation>

It should fix your issue. You can test to deploy it. 

Other notes:

  • I did try installing from Nuget. It doesn’t have the latest dlls.
  • I originally got this on my developer machine – “Could not load file or assembly ‘CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.3500.0”; this is because I didn’t have the SDK version installed but rather the runtime
  • Rather than running on IIS express, the other thing to make testing easier is that I deploy my web application to my local IIS. This will mimic a similar environment for testing purpose.

Conclusion

I hope article above can help you if you facing common error when deploying your Crystal Report. Happy coding!

If you are looking for fast and secure Crystal Report hosting, you can visit our site at https://www.asphostportal.com. Our fully featured hosting already includes

  • Easy setup
  • 24/7/365 technical support
  • Top level speed and security
  • Super cache server performance to increase your website speed
  • Top 9 data centers across the world that you can choose.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *