title: HRESULT 0x80070002 (FILE_NOT_FOUND) when trying to call CoCreateInstance for a SxS C#.NET COM DLL
body: <p>I'm trying to create a COM Object from a C#.NET DLL in an native COM client. This is the C#.NET code</p>
  
  <pre><code>using System;
  using System.Reflection;
  using System.Runtime.InteropServices;
  
  [assembly: AssemblyVersion("1.0.0.0")]
  [assembly: Guid("3B6B6C37-A5BC-45DF-878E-E9D5C8B009D8")]
  
  namespace NetTestCom
  {
      [ComImport]
      [Guid("508012FC-26A9-4985-A985-3EBB03D8D3A6"),
          ComVisible(true)]
      public interface ITestClass
      {
          int StrToInt(String S);
      }
  
      [Guid("A3D56E20-0792-42D9-B2DD-BB8A8AD75394"),
          ComVisible(true)]
      public class TestClass : ITestClass
      {
          public int StrToInt(String S)
          {
              return Convert.ToInt32(S);
          }
      }
  }
  </code></pre>
  
  <p>If i tell Visual Studio to register it for COM interop and call CoCreateInstance it works as expected.</p>
  
  <p>Now i want to use the same DLL as a registration free Side-by-Side COM. I add the dependency to my application manifest</p>
  
  <pre><code>&lt;dependency&gt;
    &lt;dependentAssembly&gt;
      &lt;assemblyIdentity
        type="win32"
        name="NetTestCom.X"
        version="1.0.0.0" /&gt;
    &lt;/dependentAssembly&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>and create an file NetTestCom.X.manifest</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"&gt;
    &lt;assemblyIdentity
      type="win32"
      name="NetTestCom.X"
      version="1.0.0.0" /&gt;
  
    &lt;clrClass
      clsid="{A3D56E20-0792-42D9-B2DD-BB8A8AD75394}"
      progid="NetTestCom.TestClass"
      threadingModel="Both"
      name="NetTestCom.TestClass"
      runtimeVersion="v2.0.50727" &gt;
    &lt;/clrClass&gt;
  
    &lt;file name="NetTestCom.dll"&gt;&lt;/file&gt;
  &lt;/assembly&gt;
  </code></pre>
  
  <p>Now when I try to call CoCreateInstance i get HRESULT 0x80070002. The application, DLL and manifest are all in the same directory.</p>