1
votes

I currently have an application setup created in Inno Setup which contains the main application and all the plugins (as components).

However, the powers that be want to be able to sell the plugins individually so they want me create a standalone setup file for the main application and standalone setup files for each plugin.

Is there a canonical way to accomplish this with Inno Setup?

1
What exactly do you want ? You have a compiled setup without source script and you want to "break" it ? Or what problems do you have with making setups for those plugins ? Could you elaborate this, please ? - TLama
@TLama: I'm trying to figure out how to create a separate setup.exe for a plugin which detects where the main app is installed (if such a thing is possible?). I can obviously just create a "dumb" setup which simply deploys the plugin where you tell it to, but I was hoping there is a better way to do it. - dr Hannibal Lecter
I see. Yes, there is a way. Even more than one. You can write the application path somewhere in registry under your own key. Or use the registry keys the Inno Setup installer made for its uninstaller (if that option was enabled). But I would recommend the first option since you'll become independent on Inno Setup's own registry rules. - TLama
@TLama: I was thinking of something along those lines, but I was hoping there was an "official" and clean way to do it, instead of making up my own. Oh well, if I do make one, I guess I'll post an answer here :) - dr Hannibal Lecter
Using your own registry key is the "official" way. Inno Setup (by default) creates registry entries where you can read the path to the uninstaller for instance, but those keys are Inno Setup's, not yours. What's worse, the pattern for creating path to that "foreign" key may change one day with some new Inno Setup version and you'd need to modify your script(s). Using your own key is steady and under your control comparing to that. - TLama

1 Answers

1
votes

My answer was provided by TLama (and Miral) in this question.

In the main application setup .iss, add a registry key with the app installation dir:

[Registry]
Root: HKLM; Subkey: "Software\Company\{#AppName}"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"

And in the plugin .iss we simply use that key if it exists, and if not install to the default path:

[Setup]
DefaultDirName={reg:HKLM\Software\Company\{#AppName},InstallPath|{pf}\Company\{#AppName}}
DisableProgramGroupPage=yes
DirExistsWarning=no

In this example, I've also disabled adding program group in the start menu for the plugin, and suppressed the warning that we're installing to a non-empty dir (since the main app is already there that's always going to be true).

Additionally, this question has information on how the DefaultDirName can be changed dynamically through the [Code] section.