title: Installed COM object uses wrong DLL and I can't rebuild if program runs
body: <p>I wrote an add-in for Enterprise Architect. It's a COM Object. This add-in uses some other project dll's.</p>
  
  <p>I created an installer which registers the Add-In's dll. This class is in the add-in's project, let's call it MyProject.dll.</p>
  
  <pre><code>/// &lt;summary&gt;
  /// Installer class for Enterprise Architect Add-In
  /// &lt;/summary&gt;
  [RunInstaller(true)]
  public class ComInstaller : Installer
  {
      #region Public Methods
  
      public override void Install( System.Collections.IDictionary stateSaver )
      {
          base.Install( stateSaver );
          RegistrationServices regsrv = new RegistrationServices();
          if ( !regsrv.RegisterAssembly( GetType().Assembly, AssemblyRegistrationFlags.SetCodeBase ) )
          {
              throw new InstallException( "Failed to register type library for COM" );
          }            
      }
  
      public override void Uninstall( System.Collections.IDictionary savedState )
      {
          base.Uninstall( savedState );
          RegistrationServices regsrv = new RegistrationServices();
          if ( !regsrv.UnregisterAssembly( GetType().Assembly ) )
          {
              throw new InstallException("Failed to unregister type library for COM");
          }
      }
  
      #endregion
  }
  </code></pre>
  
  <p>If the add-in runs, I can't build my solution because access is denied. The add-in uses the MyProject.dll which is in the Debug folder instead of the installed one.</p>
  
  <p>How can I solve this?</p>
  
  <p>Thanks,
  Maestro</p>