Announcement

Collapse
No announcement yet.

Having an issue registering a dll

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Having an issue registering a dll

    Hello I have tried a number of ways to get this dll to register. But I cannot get it to work.
    If I run manually on the computer this command:
    "C:\Windows\Microsoft.NET\Framework\v4.0.30319\reg asm" "C:\MyUtils\UL-VB\UL_DotNet.dll"
    It works fine.

    However in Setup Factory I have tried and all fail:
    1. I tried using the "Register COM Interfaces" - It says "This file does not support DLLRegisterServer (AvticeX Self-Regisration)"
    2. In the scripts "ON-Shutdown" I tried - result = File.Run("C:\Windows\Microsoft.NET\Framework\v4.0. 30319\regasm", "/s", "%AppFolder%\\UL_DotNet.dll", "%AppFolder%", true); --- This also failed.


    I am sure there is a way to get this to run but I cannot get it to work. Please Help

  • #2
    When you double click the action (File.Run), a dialog will open, showing the supplied arguments:

    Click image for larger version  Name:	image.png Views:	3 Size:	15.5 KB ID:	309130

    Here I see many errors, and each single of them would break the code. Unless everything is corrected and done according to the docs, this won't work as expected.

    Initially, just checking the fields provided, you see that the WorkingFolder and WindowModes are wrong..., while the argument is incomplete - you want a string concatenation of the "/s" and the filename being passed to regasm.exe.

    Additionally, you did not escape the backslashes of the filename path, so the program will not be found.
    And, even if the backslashes are there, you did not provide the full program name "regasm.exe" - the extension is needed when running a program via File.Run().

    Finally, you did not expand the session variables.

    This is how the arguments should look to have a better chance to work:

    Click image for larger version  Name:	image.png Views:	3 Size:	20.6 KB ID:	309131

    Yellow shows what I changed:

    1) Backslashes to escape the path properly
    2) Missing ".exe" added to filename
    3) Space inserted after "/s" and quotes around path to the DLL (which may contain spaces, would break command line syntax), also concatenated both parts to form the "argument"
    4) Added session variable expansion to the argument
    5) Added session variable expansion to the working folder
    6) Set a valid window mode

    I suggest that you place this code into the On Post Install event script:

    Code:
    result = File.Run("C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\regasm.exe", "/s \"" .. SessionVar.Expand("%AppFolder%\\UL_DotNet.dll") .. "\"", SessionVar.Expand("%AppFolder%"), SW_HIDE, true);
    Another way to get the same:

    Code:
    result = File.Run("C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\regasm.exe", SessionVar.Expand("/s \"%AppFolder%\\UL_DotNet.dll\""), SessionVar.Expand("%AppFolder%"), SW_HIDE, true);
    Ulrich


    Last edited by Ulrich; 4 weeks ago. Reason: Removed extra space inserted by board engine

    Comment


    • #3
      Hey Ulrich,

      I did what you said. However, it still did not register. So maybe I misunderstood what you put in. Here is what I just ran:


      Click image for larger version

Name:	image.png
Views:	30
Size:	20.1 KB
ID:	309136

      Comment


      • #4
        There is no space after the "/s" and it will cause a syntax error. Please copy and paste the sample code I provided.
        Also, do not use hardcoded paths. If your setup allows the user to define the target folder, you should not assume that the file to be registered is located in "C:\UltraLibrarian".

        Ulrich

        Comment

        Working...
        X