.NET COM DLL doesn't register.
-
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.
-
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.
-
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.
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.
-
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.