RegAsm.exe unable to register Dll through installshield 2016

979 Views Asked by At

We have installshield 2016 and inside this we are running installer script. That script is call through custom action.

So we are written following commnad to register "mydll.dll" as below mentioned command, C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm.exe /codebase mydll.dll The above command works perfectly fine when run manually through command prompt with administrative access.But fails through installer created using installshield script custom action.

To run command we use LaunchApplicationAndWait() and LaunchApplication() functions as strcmd = "path to cmd.exe" + "cmd.exe" strcmdopt = "path to regasm.exe" + "regasm.exe " + /codebase + path and name of dll

ret = LaunchApplication(strcmd, strcmdopt, windir, sw_normal, infinite, LAAW_OPTION_WAIT | LAAW_OPTION_SHELLEXECUTE)

similarly ret = LaunchApplicationAndWait(strcmd ,strcmdopt,LAAW_OPTION_WAIT | LAAW_OPTION_HIDDEN)

My Question is why both command not work when run through installshield custom action scripts

2

There are 2 best solutions below

0
On

You shouldn't be calling Regasm during the install. You should put the DLL as a key file in it's own component and set the COM Interop = True attribute. This will cause InstallShield to perform a regasm /regfile during the build and take the output and dynamically author it into the Registry table. During the install, MSI will simply copy the file and apply the registry entries and your done.

Note: Per MSDN doco custom functions are not called during regasm /regfile so if you are doing any wierd self registration inside your class you'll need to author that into the installer.

0
On

Is the dll distributed with the installation? if so, is the file present in the installdir (or wherever) when the script is called? Maybe add some msg box for debug purposes to see if this condition is met.

Im using deferred custom action to register .dll via regasm and it works just fine.