Saturday, September 15, 2007

Crystal Rreport Problem in .Net

I faced an error while installing a small c#(.net 2005) windows application. The crystal report was not running instead it was throwing error describing "The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception "
Solution : I have gone for google and as usual got tons of links. Thankfully, one link worked for me. It sugested me to download a merge file from
http://support.businessobjects.com/downloads/merge_modules.asp#07. Then choose English (cr_net_2003_mergemodules_en.zip) to download the .msm file.
While creating the installer for the application I had to add the merged file by selecting ADD->Merged File, which I got by right clicking on the setup in the solution explorer. Then added some dlls(CrystalDecisions.CrystalReports.Engine.dll, CrystalDecisions.ReportSource.dll,CrystalDecisions.Shared.dll, CrystalDecisions.Web.dll, CrystalDecisions.Windows.Forms.dll). Rebuild the setup. Installed it to separate pcs and bingo........ it ran as good as I expected.