Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2002
    Posts
    27

    Registering .NET COM object

    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?

  2. #2
    Join Date
    Apr 2005
    Location
    São Paulo, Brazil
    Posts
    2,539
    Quote Originally Posted by alanK View Post
    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.

    Code:
    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

  3. #3
    Join Date
    Feb 2002
    Posts
    27
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts