title: Com DLL Gives Exception .NET 4 only
body: <p>A COM DLL works in .NET 3.5 SP1, but gives exception in .NET 4.0</p>
  
  <p>The full error is </p>
  
  <blockquote>
    <p>Retrieving the COM class factory for component with CLSID {B229C879-1B52-4DE9-A42B-75C415EA1EBC} failed due to the following error: 8007045a A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A).</p>
  </blockquote>
  
  <p>If I change the target framework to 3.5 it works, back to 4.0 it doesn't.</p>
  
  <p>The application is a desktop WPF app.</p>
  
  <p>How can this be solved?</p>