Running Regasm from InnoSetup

Sometimes you have to register at install time various components for .Net Framework 2.0, using regasm.exe, but the path depends on where the framework is installed on the system. So, to save time for you, here is how can be done, using InnoSetup:

Registration:

Filename:"{reg:HKLM\SOFTWARE\Microsoft\.NETFramework,
  InstallRoot}\{reg:HKCR\CLSID\{{61b3e12b-3586-3a58-
  a497-7ed7c4c794b9%7D\InprocServer32\2.0.0.0,
  RuntimeVersion}\RegAsm.exe"; Parameters: /codebase
  Your.dll;WorkingDir: {app}; StatusMsg: "Registering
   controls ..."; Flags: runhidden;

Unregistration:

Filename:"{reg:HKLM\SOFTWARE\Microsoft\.NETFramework,
  InstallRoot}\{reg:HKCR\CLSID\{{61b3e12b-3586-3a58-
  a497-7ed7c4c794b9%7D\InprocServer32\2.0.0.0,
  RuntimeVersion}\RegAsm.exe"; Parameters: /unregister
  Your.dll; WorkingDir: {app}; StatusMsg: "Unregistering
  controls ..."; Flags: runhidden;

These have to be placed in the [Run] section.

  1. Hi,

    I am using innosetup for installing my application exe along with sql script, used one bat file for sql script installation and one application exe. The problem is i need to roolback transaction if any one in the run section fails. Please let me know can it be done with innosetup.

    Thanks,
    Manju

  2. Unfortunately I haven’t used innosetup that much, but I don’t think you will be able to run it in two different steps, like starting a transaction in the sql script then later sometime rollback the transaction.

    One approach would be to have the application installed first, then if install completes successfully, start the bat file installation. If that one fails, then you revert the previously installed files.

    Regards,
    Jancsi

  3. Thanks for the quick reply.Here the main problem is how to i get status back from bat file to innosetup and how to revert the previously installed files.

    Thanks,
    Manju

  4. You can check the result of bat file execution with errorlevel variable, there is plenty of information on this subject.
    For example: http://www.robvanderwoude.com/errorlevel.php

    I’m not sure however on aborting the install and reverting it, as I was never put in this situation. Although it is possible to abort the install, I’m not sure how possible is to abort it in a way which will make InnoSetup revert the installed files. Maybe someone on the InnoSetup forum could help you on this issue. The discussion forms can be found here

    Regards,
    Jancsi

  5. Update: New version of innosetup support constants {dotnet20} and more
    http://www.jrsoftware.org/files/is5-whatsnew.htm

Leave a Comment