C# – Crystal Reports in ClickOnce deployment

c++clickoncecrystal-reports

My application needs to print a Crystal Reports report. It does not show a preview, just takes two parameters and shows a print dialog to set the printer. It works fine on computers that have Crystal Reports installed, but I do not have a way to enforce clients have it already installed.

I have read in various places that adding the ClickOnce prerequisite "SAP Crystal Reports Runtime Engine for .NET Framework" would allow the required Crystal Reports libraries to be registered on the client. When installing the application on the client, it does download the runtime, and installs the runtime, but the application fails to install stating that various CrystalDecisions and CrystalReports assemblies must be registered in GAC.

The first is CrystalDecisions.ReportAppServer.CommonObjectModel. If I add a reference to this in the project and redeploy, then it just gives another message about another assembly. I literally did this 15 times, and never got a seamless install.

What am I missing? I followed this guide from the SAP website (zipped, 2.2 MB, contains a Microsoft Compiled HTML Help file, crnet_dg_2010_en.chm).

Best Solution

I had this problem: for Click-Once applications, you must download and install the 32-bit version of the Crystal Reports Runtime on the client regardless of the client computer's architecture. I ended up installing both the 32-bit and the 64-bit using the MSIs provided on SAP's site to cover all bases and make the GAC error to go away. Afterwards, everything ran smoothly.

Download and install the MSIs (not the executable) from here

FOR CLICK ONCE DEPLOYMENT

In addition to making SAP Crystal Reports Runtime a prerequisite, you need to modify the product.xml file on the development machine. This file is located in: {Program Files}\Microsoft SDKs\Windows\v*.0A\Bootstrapper\Packages\Crystal Reports for .NET Framework 4.0\

Find the following line and comment it out: <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel"/>

Now, re-publish your solution and the setup should install both runtimes on 64-bit machines.