title: RegAsm for Class Library Used in VB6 Application
body: <p>To be short and to the point, I've built a C# class library that is both COM-Visible and Registered for COM Interop.  I've compiled the library, which resulted in the generation of .dll and .tlb files.</p>
  
  <p>I have another machine that's running a VB6 application.  So, I copied the .dll and .tlb files over to C:/Windows/system32 folder on the machine.  I then registered those files using the following:</p>
  
  <pre><code>C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm C:\Windows\system32\TestClass.dll /tlb:TestClass.tlb
  </code></pre>
  
  <p>After the files were registered successfully, I added a project reference to the Test.tlb file from inside my VB6 app, then I tried to invoke a method in my new referenced class like so:</p>
  
  <pre><code>Dim myObject As TestNamespace.TestClass
  Set myObject = New TestNamespace.TestClass
  MsgBox (myObject.TestMethod())
  </code></pre>
  
  <p>It doesn't work, and I receive a -2147024894 Automation Error.</p>
  
  <p>I've read that I shouldn't install the dll into a private folder like system32.  I should either be registering in the GAC or I should be registering in another location using the "/codebase" option:</p>
  
  <pre><code>C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm C:\TestClass.dll /tlb:TestClass.tlb /codebase
  </code></pre>
  
  <p>Is there any reason I shouldn't be using system32?  Past devs that have worked on this project have placed assembly files used by this VB6 project into system32 and there haven't seemed to be any issues.</p>
  
  <p>When I register my dll in the system32 location, I get the Automation Error.  When I register my dll in another location (i.e. C:/), the method call into my class library from VB6 works as expected.  What gives?</p>
  
  <p>I should mention that we will NOT be using the GAC to register any DLL's.  That's just the way it is.</p>
  
  <p>Any help is appreciated.</p>
  
  <p>Mike</p>