Crystal Reports “Class not registered” WPF

2019-09-04 14:40发布

I have a shiny WPF (4.0) app that I need to add Crystal Reports to. I downloaded and installed CR for VS2010, then after that we purchased and installed Crystal Reports 13 (which has the WPF CrystalReportsViewer).

As a test, I created a new "Crystal Reports WPF Application" project in Visual Studio. I created a report, linked it to my DB (Sql Server), and previewed the report. All was well.

I then copied the CrystalReportsViewer window into my "real" app (same machine and framework), added the same references and tried to run the same code:

        ReportDocument _report;
        this._report = new ReportDocument();
        this._report.Load(@"CrystalReport1.rpt");
        this.reportViewer.ViewerCore.ReportSource = _report;

However in my "real" application it bombs out on the second line with the error:

    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've double and triple checked that the references are the same in both projects.
  • I've gone through all obscure project and solution properties.
  • I've added a new Crystal Report to the project so it would add the references that way instead of manually.
  • Google says "make sure the framework is Framework 4 not Framework 4 Client Profile". Google also says "make sure the framework is Framework 4 Client Profile not Framework 4". I've tried both to no avail.
  • The product is registered.

What else can I do? I don't want to add my entire project to the test app!

I've been using Crystal Reports since about version 3, and not once in ANY of those versions has it cleanly installed, registered, built reports, added them to an app and deployed. You'd think that after 13 versions they'd either be able to get it right, or my various employers would choose another reporting tool!

2条回答
Bombasti
2楼-- · 2019-09-04 15:13

Got it. One solution needed to be changed from "Any CPU" to "x86" in Configuration.

查看更多
一纸荒年 Trace。
3楼-- · 2019-09-04 15:22

Installing the standalone x64 and x86 packages solved this error for me.

查看更多
登录 后发表回答