Crystal Report in .NET Framework 4.0
Asked Answered
M

5

7

We've a WPF application written in .NET 3.5 using Visual Studio 2010. The solution consists of 8 projects - all compiled in .NET 3.5. The application uses Crystal Report. Target OS is Windows 7.

Recently, the startup project is compiled in .NET 4.0 due to some 3rd party DLL dependency - those DLLs require .NET 4.0. After this change and rebuilding the solution, Crystal Report is throwing exception.

The problem occurs at the constructor of ReportClass.

Exception's message:

The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception.

InnerException's message:

"Retrieving the COM class factory for component with CLSID {4DB2E2BB-78E6-4AEA-BEFB-FDAAB610FD1B} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))."

I haven't worked in Crystal Report before. What could be the cause of this problem?

Please note that this problem doesn't occur when compiled as .NET 3.5. Crystal Report is used in the startup project.

Monogenic answered 30/8, 2012 at 11:1 Comment(6)
Do you need to register the Crystal Reports DLL as a COM object?Flodden
I think that you need to build all the projects using .net 4.0, don't know exactly why right now.Choreographer
@zeencat: not sure what do you mean. i didn't register the DLLs in 3.5.Monogenic
I'm just wondering if this is your issue as I had a similar error with a different dll. This worked for me, may be a complete shot in the dark. msdn.microsoft.com/en-us/library/tzat5yw6(v=vs.71).aspxFlodden
I found a solution [here][1]. This fixes my problem. [1]: https://mcmap.net/q/99378/-retrieving-the-com-class-factory-for-component-with-clsid-xxxx-failed-due-to-the-following-error-80040154Monogenic
Does this answer your question? Retrieving the COM class factory for component with CLSID {XXXX} failed due to the following error: 80040154Carmichael
K
16

It is likely to be X86/x64 problem.

try to compile your app to target 86 platform.

Kapellmeister answered 18/3, 2013 at 10:15 Comment(0)
Q
4

This issue got me for 2 days and its all over the place with very similar answers, however what it ended up being for me was two-fold. I am adding here in hopes it saves someone at least a day..

A lot of post mention this; Go to IIS -> application pools -> click right button on your application pools -> go to advance setting -> Enable 32 bit application = True

Please note that in my case I was building and deploying on a 64bit machine so I set the True to False and it did it. Again, simple enough but not something I thought was related so my mind was blank to it after I made the adjustment.

The other point of interest is to make sure that you do have the CRRuntime_xx.x.x.MSI loaded on Deployment server.

Thank you everyone here for the amazing info at the end of the day it got me through.

Quake answered 10/1, 2018 at 21:28 Comment(1)
Although appriciation is good, I don't think you should turn your answer into an appriciation letter. Keep it more onto the point.Collude
E
3

Go to IIS -> application pools ->click right button on your application pools -> go to advance setting -> Enable 32 bit application = True

Etsukoetta answered 29/1, 2017 at 9:42 Comment(0)
C
0

When you install CR it should install few files (JS,html etc etc) on C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319\crystalreportviewers13. Check if this folder exists on your pc. If not, I think you need to copy the folder from program files to this location.

Choreographer answered 30/8, 2012 at 11:57 Comment(0)
A
0

These answers got us to the right place but not until we did some troubleshooting. It did end up being a 32/64 bit issue on our local dev machines running Visual Studio 2019 and IIS Express.

In our case the issue was that the setting for "Use the 64 bit version of IIS Express for web sites and projects" had been enabled in visual studio settings. We use the 32 bit version of crystal on our dev machines so we had to Uncheck this box for it to work correctly.

enter image description here

Artemis answered 6/8, 2021 at 15:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.