Question

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).

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top