Search code examples
c#crystal-reports

The type initializer for 'crystaldecisions.shared.sharedutils' threw an exception. in c#



I build an app to retrieve email from gmail , save it in database and print using crystal report.
I stack trace the exception it was throwing , and it was related to crystal report
Heres the screenshot of the trace:

enter image description here

However I have another application on same machine using same version , build on same development PC and it works perfectly.
I googled it and says to install 64 bit crystal, my concern if I have same crystal report running fine then this should too.
Please help
Thanks


Solution

  • Check the Platform of your projects in Configuration Manager. Does your C# project have a target platform of "Any CPU"?

    When you create projects that target any CPU the program will require both 32 and 64 bit versions of the CR client installed.

    If you target only 32 bit systems with the application, then it will only need the 32 bit client installed.

    32 bit apps will target the "x86" platform while 64 bit apps target the "x64" platform.

    You may also need to look at the properties for each project in your solution as well since there is another way to control the targeted platform there. It should update when you change it in Configuration Manager, but there are some settings in Visual Studio that can prevent that from happening and then you get build errors for the entire solution until the target platform in both are the same for each project in a solution.