title: Class not registered error for Instantiation of C# object via COM from VC++
body: <p>In a VC++ project, I am trying to create an instance (via COM) of a C# class contained within a C# project.</p>
  
  <p>Facts</p>
  
  <ul>
  <li>Both the C# and C++ projects are compiled using .NET 4.0</li>
  <li>The C# .dll is being registered using <strong>regasm /codebase "CSharpProjectName.dll"</strong>", and windows command prompt reports, "Types registered successfully."</li>
  <li>In the c++ project, I attempt to create an instance of a class in the C# project, but I get an HRESULT of <strong>0x80040154 - class not registered</strong></li>
  </ul>
  
  <p>Here is an example of my attempt to create an instance of the .NET object from the C# .dll.  The concrete class I am trying to instantiate is called Employee, which for the sake of presenting my question simply, implements the IPerson interface:</p>
  
  <pre><code>    CSharpProjectName::IPersonPtr pPersonPtr;
      HRESULT hr = pPersonPtr.CreateInstance(CSharpProjectName::CLSID_Employee);
  </code></pre>
  
  <p>Why am I getting a "class not registered" error even though I registered the c# .dll using "regasm /codebase" and confirmed existence of the key in the registry?</p>
  
  <p>Any help would greatly be appreciated.  Thanks!</p>