我们有一个使用 Visual Studio 2010 在 .NET 3.5 中编写的 WPF 应用程序.该解决方案由 8 个项目组成 - 全部在 .NET 3.5 中编译.该应用程序使用 Crystal Report.目标操作系统是 Windows 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.
最近,由于某些 3rd 方 DLL 依赖性,启动项目 在 .NET 4.0 中编译 - 这些 DLL 需要 .NET 4.0.在此更改并重建解决方案后,Crystal Report 抛出异常.
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.
问题出现在ReportClass
的构造函数中.
The problem occurs at the constructor of ReportClass
.
异常消息:
类型初始化器'CrystalDecisions.CrystalReports.Engine.ReportDocument' 抛出了一个例外.
The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception.
InnerException 的消息:
InnerException's message:
"正在检索具有 CLSID 的组件的 COM 类工厂{4DB2E2BB-78E6-4AEA-BEFB-FDAAB610FD1B} 由于以下原因而失败错误:80040154 类未注册(HRESULT 异常:0x80040154 (REGDB_E_CLASSNOTREG))."
"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))."
我以前没有在 Crystal Report 工作过.这个问题的原因可能是什么?
I haven't worked in Crystal Report before. What could be the cause of this problem?
请注意,编译为 .NET 3.5 时不会出现此问题.Crystal Report用于启动项目.
Please note that this problem doesn't occur when compiled as .NET 3.5. Crystal Report is used in the startup project.
很有可能是X86/x64的问题.
It is likely to be X86/x64 problem.
尝试将您的应用编译为面向 86 平台.
try to compile your app to target 86 platform.
这篇关于.NET Framework 4.0 中的水晶报表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!