title: Crystal Report in .NET Framework 4.0
body: <p>We've a WPF application written in <strong>.NET 3.5</strong> using <strong>Visual Studio 2010</strong>. The solution consists of 8 projects - all compiled in <strong>.NET 3.5</strong>. The application uses Crystal Report. Target OS is Windows 7.</p>
  
  <p>Recently, the <strong>startup project</strong> is compiled in <strong>.NET 4.0</strong> 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.</p>
  
  <p>The problem occurs at the constructor of <code>ReportClass</code>.</p>
  
  <p>Exception's message:</p>
  
  <blockquote>
    <p>The type initializer for
    'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an
    exception.</p>
  </blockquote>
  
  <p>InnerException's message:</p>
  
  <blockquote>
    <p>"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))."</p>
  </blockquote>
  
  <p>I haven't worked in Crystal Report before. What could be the cause of this problem?</p>
  
  <p>Please note that this problem doesn't occur when compiled as .NET 3.5. Crystal Report is used in the startup project.</p>