title: COM library failing to register in .NET Core
body: <p>I am working with some COM libraries which allow me to connect to the <a href="https://www.ibm.com/support/knowledgecenter/SSEQ5Y_5.9.0/com.ibm.pcomm.doc/books/html/host_access08.htm" rel="nofollow noreferrer">IBM PCOMM API</a>. I am trying to obtain a list of connections, from an object called <code>AutConnList()</code>. The code looks like this:</p>
  
  <pre><code>using AutConnListTypeLibrary;
  using AutOIATypeLibrary;
  using AutPSTypeLibrary;
  
  public static List&lt;string&gt; GetSessions()
  {
      var sessions = new List&lt;string&gt;();
  
      AutConnList connectionList = new AutConnList();
      connectionList.Refresh();
  
      for (int i = 1; i &lt;= connectionList.Count; i++)
      {
          IAutConnInfo sessionInfo = (IAutConnInfo)connectionList[i];
          sessions.Add(sessionInfo.Name);
      }
  
      return sessions;
  }
  </code></pre>
  
  <p>I compile the code to both .NET Framework (4.6) and .NET Core (3.0) as it is intended as a library used by many different programs. The multi-compiling is done by adding the following line to the .csproj file:</p>
  
  <pre><code>&lt;TargetFrameworks&gt;netcoreapp3.0;net46&lt;/TargetFrameworks&gt;
  </code></pre>
  
  <p>The method works as intended, when consumed from .NET Framework applications, but when I try to consume it from .NET Core, I get the following exception:</p>
  
  <blockquote>
    <p>Retrieving the COM class factory for component with CLSID
    {9DF30780-6F18-11D0-910D-0004AC3617E1} failed due to the following
    error: 80040154 Class not registered (0x80040154
    (REGDB_E_CLASSNOTREG)).</p>
  </blockquote>
  
  <p>I have tried solutions from different posts about similar issues (like <a href="https://stackoverflow.com/questions/4021796/error-80040154-class-not-registered-exception-when-initializing-vcprojectengin">this</a>), but without luck. Also, I haven't found any other posts, where the problem only occurs in a specific framework.</p>
  
  <p>I dont know if it has anything to do with the differences in referenced assemblies, but the error code doesn't really suggest that?</p>
  
  <p><a href="https://i.stack.imgur.com/XUFyE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XUFyE.png" alt="enter image description here"></a></p>
  
  <p>Have anyone encountered similar issues, and if so, how did you solve it?</p>