title: Developing Reg-Free COM application with VB6
body: <p>I'm maintaining a VB6 application with many COM components (DLLs and OCXs). In order to streamline development and deployment I'd like to use reg-free com. The problem with development is that the application runs within the VB6.EXE instance. How can I trick VB6 to use my (unregistered) components? It is very important for me to not have to go through registering/unregistering components when switching between branches. Generating a .manifest file for VB6 is not out of the question but is there some other, more optimal way, to specify a .manifest file when launching VB6.EXE?</p>
  
  <p>Note: The Activation Context API doesn't seem to help, even if used from within the development environment.</p>
  
  <p>Solutions I've thought:</p>
  
  <ul>
  <li>A utility application that activates a context from a manifest and launches VB6 as a child process (doesn't work; processes don't inherit activation context)</li>
  <li>Injecting context activation into the VB6 process at startup (too complicated; must hack the executable to do this)</li>
  <li>Hosting VB6 in my own process after activating the right context (can't even find out if this is possible)</li>
  <li>Using a VB6 Add-In or other utility that runs within VB6 to activate a context (tried that but it doesn't seem to work)</li>
  </ul>
  
  <p><strong>Update Jan. 16</strong></p>
  
  <p>As suggested by <a href="https://stackoverflow.com/users/40691/wqw">wqw</a>, I did some testing with a VB.exe.manifest. The VB6.exe.manifest worked, with some caveats:</p>
  
  <ul>
  <li>The SxS dll specified in the manifest would not appear in the references window on projects that didn't actually reference the component</li>
  <li><p>On projects that did reference the component it would be shown to reside in the directory according to the following order:</p>
  
  <ol>
  <li>The pathname recorded in the project file (if the file was still present)</li>
  <li>A pathname as if it resided in the same folder as the project (vbp)</li>
  </ol>
  
  <p>If the file was not in any of these folders, the project would not compile (just running the code causes an internal compile in VB6) with the message "Can't find project or library".</p></li>
  </ul>
  
  <p>Obviously, VB6 actualy scans the registry to find COM components and verifies, during compilation, that they exist where they say they exist. I'm not sure what that might mean if I actually want to use VB6.exe.manifest to redirect COM component instantiation. Perhaps having dummy component files at some predefined location might trick VB6 into believing that everything is as it should be, although an entirely different set of components got loaded for use.</p>
  
  <p><strong>Further update:</strong></p>
  
  <p>I did a test on that last assumption and it proved to be false. The component has to actually be there in order for the project to compile. It must even properly load (no dummy, zero-length files accepted!). Now I'm not even sure if the manifest works. That's a more time-consuming test (requires a component with two versions that produce different results, one with the project, and one for the manifest).</p>