我们有一个使用Visual Studio 2010编写的WPF应用程序,使用.NET 3.5编译的8个项目。该应用程序使用Crystal Report,并针对Windows 7操作系统进行了定位。最近,由于某些第三方DLL依赖项需要.NET 4.0,因此将“启动项目”编译为.NET 4.0。在更改后并重新构建解决方案后,Crystal Report会抛出异常。问题发生在ReportClass的构造函数处。异常信息如下:The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception. 内部异常信息如下: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。这个问题的原因是什么呢?请注意,在.NET 3.5编译时不会出现此问题。 Crystal Report在启动项目中使用。