Skip to Content

Crystal Reports & Assembly References

Recently, I was trying to update one of my projects created in visual studio 2005. This project had a number of Crystal Reports designed using Crystal Reports XI R2 (CR XI R2). I opened my Visual Studio 2005 & started updating the project. Whenever I was trying to access the report I was getting the following error:

“The type initializer for ‘CrystalDecisions.CrystalReports.Engine.ReportDocument’ threw an exception.”

Now, I started thinking on what to do as I had multiple versions of Crystal Reports starting from 9.1 till 11.x.  I also had different versions of Visual Studios (2003, 2005, 2008, and 2010). At first, I thought CR XI R2 is not compatible with VS2010 hence I am unable to view it in my project. When I gave second thought, I realized that this has to do something with my project, not visual studio.

I deleted the viewer from my design page. I checked my web.config for references; I could see the mixed references of Crystal Reports i.e. few of the references pointed to old version & few to new version. So, I removed them (only Crystal’s) to make sure that I am not left with any. I dragged the viewer from toolbox on the design page. I re-added the references and this time made sure that I have the latest ones in my web.config.

After adding the references I recompiled my project and could see the reports. Finally, I could breathe a sigh of relief.

Be the first to leave a comment
You must be Logged on to comment or reply to a post.