Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. COM
  4. .NET COM DLL doesn't register.

.NET COM DLL doesn't register.

Scheduled Pinned Locked Moved COM
csharpcomwindows-adminhelp
4 Posts 2 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Joni_78
    wrote on last edited by
    #1

    I made a .NET COM DLL (VS2012, C#) it registers fine with regasm, but not with regsvr32. Also when I add the .tlb into installer and extract the com stuff (Installshield 2012) there is no registry entries after I have ran the installer. DLL is 32-bit and I'm using 64-bit Windows. I have this on the code:

    [ComRegisterFunction()]
    public static void RegisterClass(string key)
    {
    StringBuilder sb = new StringBuilder(key);
    sb.Replace(@"HKEY_CLASSES_ROOT\", "");
    RegistryKey k = Registry.ClassesRoot.OpenSubKey(sb.ToString(), true);
    RegistryKey ctrl = k.CreateSubKey("Control");
    ctrl.Close();
    RegistryKey inprocServer32 = k.OpenSubKey("InprocServer32", true);
    inprocServer32.SetValue("CodeBase", Assembly.GetExecutingAssembly().CodeBase);
    inprocServer32.Close();
    k.Close();
    MessageBox.Show("Registered");
    }

        \[ComUnregisterFunction()\]
        public static void UnregisterClass(string key)
        {
            StringBuilder sb = new StringBuilder(key);
            sb.Replace(@"HKEY\_CLASSES\_ROOT\\", "");
            RegistryKey k = Registry.ClassesRoot.OpenSubKey(sb.ToString(), true);
            k.DeleteSubKey("Control", false);
            k.OpenSubKey("InprocServer32", true);
            k.DeleteSubKey("CodeBase", false);
            k.Close();
            MessageBox.Show("UnRegistered");
        }
    

    I've tried to find an answer to this but it seems nothing works. Error with regsvr32 is: the module "comclass.dll" was loaded but the entry-point DllRegisterServer was not found. Make sure that "comclass.dll" is a valid DLL or OCX file and then try again.

    L 1 Reply Last reply
    0
    • J Joni_78

      I made a .NET COM DLL (VS2012, C#) it registers fine with regasm, but not with regsvr32. Also when I add the .tlb into installer and extract the com stuff (Installshield 2012) there is no registry entries after I have ran the installer. DLL is 32-bit and I'm using 64-bit Windows. I have this on the code:

      [ComRegisterFunction()]
      public static void RegisterClass(string key)
      {
      StringBuilder sb = new StringBuilder(key);
      sb.Replace(@"HKEY_CLASSES_ROOT\", "");
      RegistryKey k = Registry.ClassesRoot.OpenSubKey(sb.ToString(), true);
      RegistryKey ctrl = k.CreateSubKey("Control");
      ctrl.Close();
      RegistryKey inprocServer32 = k.OpenSubKey("InprocServer32", true);
      inprocServer32.SetValue("CodeBase", Assembly.GetExecutingAssembly().CodeBase);
      inprocServer32.Close();
      k.Close();
      MessageBox.Show("Registered");
      }

          \[ComUnregisterFunction()\]
          public static void UnregisterClass(string key)
          {
              StringBuilder sb = new StringBuilder(key);
              sb.Replace(@"HKEY\_CLASSES\_ROOT\\", "");
              RegistryKey k = Registry.ClassesRoot.OpenSubKey(sb.ToString(), true);
              k.DeleteSubKey("Control", false);
              k.OpenSubKey("InprocServer32", true);
              k.DeleteSubKey("CodeBase", false);
              k.Close();
              MessageBox.Show("UnRegistered");
          }
      

      I've tried to find an answer to this but it seems nothing works. Error with regsvr32 is: the module "comclass.dll" was loaded but the entry-point DllRegisterServer was not found. Make sure that "comclass.dll" is a valid DLL or OCX file and then try again.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Joni_78 wrote:

      the entry-point DllRegisterServer was not found.

      There is a fairly strong clue in that message, regsvr32 needs the correct entry point to be in the DLL.

      One of these days I'm going to think of a really clever signature.

      J 1 Reply Last reply
      0
      • L Lost User

        Joni_78 wrote:

        the entry-point DllRegisterServer was not found.

        There is a fairly strong clue in that message, regsvr32 needs the correct entry point to be in the DLL.

        One of these days I'm going to think of a really clever signature.

        J Offline
        J Offline
        Joni_78
        wrote on last edited by
        #3

        I've found atleast five solutions to this but none worked. I found that you can save the dll registry entries to reg file with "regasm /regfile:name.reg name.dll" So I can just add the registry keys to installshield, I wonder if it does everything that regsvr32 does.

        L 1 Reply Last reply
        0
        • J Joni_78

          I've found atleast five solutions to this but none worked. I found that you can save the dll registry entries to reg file with "regasm /regfile:name.reg name.dll" So I can just add the registry keys to installshield, I wonder if it does everything that regsvr32 does.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Joni_78 wrote:

          I wonder if it does everything that regsvr32 does.

          No idea, I'm afraid, but it would be easy to test.

          One of these days I'm going to think of a really clever signature.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups