PJW
PJW

Reputation: 5397

Embedding Crystal Reports into a WinForms Application

I have a winforms application with a sql server database backend. I've designed some reports using Crystal Reports and have embedded these into the winforms application. They all work fine on my computer (which has crystal reports 2011 installed). However, when I distribute my application to a client machine, attempting to run the form with the embedded crystal report produces the following error -

The type initializer for 'CrystalDecisions.Shared.SharedUtils' threw an exception

I considered this might be because Crystal Reports is not installed on the client machine, so I installed the Crystal Reports Runtime on the client machine (which shows as correctly installed in the Control Panel > Programs etc. However the error persists.

I'm really hoping it isn't necessary to purchase a license for every client machine as there are many and the costs would be prohibitive. I had thought with the appropriate run-time, an embedded crystal reports would work in my distributed application.

Can an application with embedded crystal reports be distributed to client machines that do not have crystal reports installed? If so, what is likely to be producing this error message?

Here is a screenshot of the full error message

Error Message

Upvotes: 0

Views: 1526

Answers (1)

PJW
PJW

Reputation: 5397

After a lot of trial and error the problem was resolved by -

  1. Installing Crystal Reports for Visual Studio 2010 SP5 64 bit on the developer's machine
  2. Installing Crystal Reports Runtime MSI SP5 64 bit on the client machine
  3. Installing Crystal Reports Runtime MSI SP5 32 bit on the client machine

I'm still at a loss as to why step 3 was necessary when the client machine has a 64 bit operating system, but the issue was only resolved when both 64 bit and 32 bit runtimes were installed.

Now the embedded Crystal Reports display fine in the Winforms application on the client machine. Hope that saves someone else some head scratching.

Upvotes: 1

Related Questions