View Full Version : Registering .NET COM object
alanK
08-03-2009, 02:42 AM
I am creating a .NET module as a COM object (so it can be used by non .NET callers).
I've tried SUF8, using the Test buttom on the OLE/ActiveX section in the Advanced tab of File Properties. This tells me the DLL doesn't support self registration.
I guess this is no surprise, as you need to used utility RegAsm for .NET COM objects, not the good old RegSvr32.
Question is: Can SUF8 register .NET COM objects? If yes, how?
Ulrich
08-03-2009, 10:41 AM
Can SUF8 register .NET COM objects? If yes, how?
Hello,
you already answered your own question, when you wrote "you need to use utility RegAsm for .NET COM objects".
What follows is an example. You should adapt this to fit your needs, and probably place this in the On Post Install event script.
function FindRegAsm()
-- locate Microsoft .NET Framework Assembly Registration Utility
local regasm = "";
local rootfolder = _WindowsFolder .. "\\Microsoft.NET\\Framework";
local versions = Folder.Find(rootfolder, "v?.*", false);
local i, folder;
for i, folder in versions do
regasm = folder .. "\\RegAsm.exe";
if (File.DoesExist(regasm)) then
SetupData.WriteToLogFile("Detected RegAsm.exe as " .. regasm .. "\r\n", true);
-- quit loop
break;
end
end
return regasm;
end
utility = FindRegAsm();
if (utility ~= "") then
File.Run(utility, SessionVar.Expand("%AppFolder%\\MyComponent.ext"), SessionVar.Expand("%AppFolder%"), SW_MINIMIZE, true);
else
SetupData.WriteToLogFile("ERROR\tRegAsm.exe not found, can't register component!\r\n", true);
end
Ulrich
alanK
08-05-2009, 02:16 AM
Thanks, Ulrich. That's quite clear. I just thought that SUF8 would make the process a bit easier, as it does for ActiveX, given that .NET has been around for quite a while.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.