Search code examples
c#vb.netcrystal-reports

How to fix CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception


Good afternoon,

I had this error The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception. and this Incorrect syntax near 'CrystalDecisions' when i run the program on server.

I tried a lot of things to solve this.

Things i tried:

  1. Verify dll's
  2. On build insert dll with exe files
  3. Re-install SAP Bussiness Enterprise 4.0
  4. Re-install CrystalReport both versions(x32,x64) and unistall one to use just one(with that i had more problems because my company software work with both versions)
  5. Verify FrameWork i'm using because for this specific CrystalReport funciton i needed to change Framework 4.0 Client Profile to only Framework 4.0

Solution

  • The solution i find was on change TargetCPU on Project Properties -> Compile -> Advanced Compile Options -> Set Target CPU from X86 to AnyCPU