0

I have an inno setup project which includes 5 different sub-programs, installable as components. Many of the dlls that end up in the final program folder are shared between some of these, but not all. I've made a tool to sort out the common dlls to make my installer as compact as possible.

Because of the shared parts, the space requirements for these components simply don't show up at all. On its own, that's not really a problem, but the total size at the bottom of the components selector only seems to combine files installed for all components, and the size of components for which the size can be calculated.

While showing individual sizes is not possible due to the shared files, the total size is perfectly determinable. Is it possible to somehow give the user a correct total size estimate there?

On a related note... is there a simple way to make sure at least one component needs to be selected? Simply adding the Components: to every line in Files didn't work. I currently just have an error box on NextButtonClick after a check of all components with IsComponentSelected, but I was wondering if there's a more... elegant solution, since this requires code modification if I ever need to add more components (which, in the current project, is a very real possibility).

Nyerguds
  • 5,360
  • 1
  • 31
  • 63
  • 3
    Note that if the common DLLs come from the same source folder then Inno will only store one copy of them inside the installer even if you have multiple `[Files]` entries that copy it to multiple destination folders. Also note that using `Check` functions removes the files from disk space calculations (as Inno is unable to determine what conditions might change the result), but otherwise they should show up as expected (and the disk space caption does say that it's a minimum). – Miral May 21 '13 at 21:21
  • Regarding your query about requiring one selected component: you can walk through the items `WizardForm.ComponentsList` and ensure that at least one item is ticked; that's about the only way to have it automatically include additional components added later. But you'd need to be careful if you're also using subcomponents. – Miral May 21 '13 at 21:24
  • _"Also note that using Check functions removes the files from disk space calculations"_ - Ahh, that explains a lot. There are two different builds of the whole project included in the installer (for two database architectures on the customer system), separated by a choice in a custom screen at the very start. So _all_ entries have a check to differentiate between these two. I'd just make them two installers, but I was asked to make it a single one. – Nyerguds Jun 26 '13 at 13:57
  • There are no sub-components, so that's not a problem. It's just that the existing components have common files, which are, logically, always installed, but installing _just_ the common files without any of the components is utterly useless, of course. – Nyerguds Jun 26 '13 at 14:02
  • @Miral: could you post that first comment as actual answer so I can accept it? It's what made me figure out the real problem. – Nyerguds Jun 27 '13 at 07:24

1 Answers1

0

If it does not make sense to install the common files without the application, or the application without the common files (eg. the files are dependencies of the application), then simply don't list them as [Components] at all (components are just a UI thing):

[Components]
Name: app1; Description: "Application 1"
Name: app2; Description: "Application 2"
Name: app3; Description; "Application 3"

[Files]
Filename: ...\app1.exe; ...; Components: app1
Filename: ...\app2.exe; ...; Components: app2
Filename: ...\app3.exe; ...; Components: app3
Filename: ...\common.dll; ...; Components: app1 app2

This will install common.dll if either or both of app1 or app2 are selected, but not if neither are. It does not matter whether app3 is selected or not. (Note that if a file is common to all of your components then you can just leave out the Components: parameter entirely.)

In order to guarantee that at least one component is selected you will need to walk through the WizardForm.ComponentsList in the NextButtonClick of wpSelectComponents, or (if you don't mind hard-coding the names of all the components) ensure that IsComponentSelected returns true when supplied with the names of all components.

Miral
  • 12,637
  • 4
  • 53
  • 93
  • _Note that if a file is common to all of your components then you can just leave out the Components: parameter entirely._ - this is actually the issue, I think... this is not really true. If you leave off the components, you can install the program selecting none of the components, which will only install the common files. I think you're missing the point here: the issue is not the application installing without the common files - the issue is the ability to install the program with _only_ the common files, without any of the actual _components_. – Nyerguds Jun 27 '13 at 07:17
  • I don't know if making sure all of the files are linked to components actually does block continuing past the components screen when you deselect them all, though. I haven't had a chance to test that. – Nyerguds Jun 27 '13 at 07:29
  • It doesn't. But I already suggested how to solve that in my earlier comment. – Miral Jun 28 '13 at 01:11
  • Yes, I know. It's just rather odd behaviour. Ah well. Thanks for the help I'll accept this answer, even though it's kinda the other thing you said (about the file sizes and the check flag) that was more useful to me :p – Nyerguds Jul 04 '13 at 05:39