three components in three user defined locations - inno-setup

I saw this excellent article: Inno Setup - Correct use of [Types], [Components] and [Tasks] on components and types.
I currently have three separate setup.exe projects (iss) to install:
The program executable (default to: C:\ProgramFiles/ ) i.e. {pf}
a setup of js/css/html (default to: c:\wwwroot\sherlock
a setup to install image files (jpg/png) files (default to: c:\wwwroot\toby
I want the user it be able to redirect the default locations for each of these three "components" (i.e. perhaps his /wwwroot is on the G drive, or something like that. I don't see anyway in the Source: command other than to send this to {app}
Source: "Z:\EGPL Librarian Releases\Sample Installation\wwwroot\Sherlock\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Question: can this be done with components and types as the above article?
Should I rather create an installer of installer programs and keep the three separate setups? (And can you show me an example of an installer of installer programs?)
I am looking for a simple solution, since I have other work to do.

See this page. Note that it was written for an older version of Inno, but it should be easy enough to adapt.
Components/Tasks are for optional things. If your items are not optional then there's not much point in using them.
As for whether to make a single installer or an installer of installers -- the main question there is what you want to happen at uninstall time. If you want the user to be able to uninstall each part separately then you must create separate install scripts with unique AppIds (and then optionally make an installer of installers for them). If you want them to always be uninstalled together then you can make a single script.

Related

How to support thousands of files using Inno Setup?

I'm using Inno Setup to write an installer for an application based on Node.js. Then our node application (including modules) consists of almost 4,000 files. The installer needs to copy all of these files, as well as remove them during uninstallation.
I've already written this to use a ZIP file which gets extracted during installation, and recursively delete files during the uninstall. But I would have to write a tremendous amount of code to be able to properly handle file copy/replace/delete operations, while I could register them in my Inno Setup script and let the installer do all that work (as it's designed to do). The problem with that is I'm not about to manually write almost 4k lines of code (and manage them when frequent additions are made) for each file. I could write a small app to iterate through the files and write ISS script, but that's another project I'm not about to start.
Is there a way to not only add, but manage groups of files in bulk in recursive folders? Perhaps a custom IDE meant for this?
There are many way to add all files to inno setup:
You can use Flags: recursesubdirs;
For example:
[Files]
Source: "C:\Source Folder\*"; DestDir: "{app}"; Flags: recursesubdirs
You can use inno setup quick start pack
You can install Only Istool
TO put files in Istool open Files and directory section in Istool Drag and drop all (Select Thousand of files or Folder if any with Ctrl+A)
Thousand Of files in the Files and directory section of Istool and save.
PS: If you use Istool then save the Documents and open with inno setup.
I personaly Use Istool.
Thanks

InnoSetup's ignoreversion flag: For which file types?

InnoSetup has the ignoreversion flag for items in the [Files] section to specify that the file should be copied regardless of its version information. This is kind of the default that I would expect from a setup most of the time, yet it is not the default behaviour if it is not set. So I see this flag set in most setups for every file item, executables and non-executables alike.
I'm wondering what the file types are for which this flag makes any difference? Obviously .exe and .dll are affected, and .txt is not. Is there some definitive guide on this? I'd like to get rid of these extra flags on my file items if they serve no purpose.
The general recommendation I always give is to absolutely always use ignoreversion on every file in {app}.
It causes no harm on files without resources (and potentially improves performance in that Inno doesn't have to waste time discovering that they lack resources), and is almost always what you want for app files (otherwise you can end up in some weird frankenstate with a mixture of files).
However for files installed outside of {app} (typically either {sys} or {cf}) you usually should not use ignoreversion and should instead only permit upgrades. But YMMV.
(Note that special care may need to be taken for ensuring upgrades of common files outside of {app}, as only EXE and DLL files typically have version information, and even some of those may lack it or it may not be updated consistently, depending on the source of the file. Other considerations also apply to common files, such as using sharedfile.)
(Promoted comment to answer.)
For which file types is the "ignoreversion" flag meaningful ?
For those that can have Windows resources. Version information reading in Inno Setup falls deep down to Windows API so it's actually the system which determines from which files the version information can be read. Currently, the About Version Information topic specifies the files, that can have version information briefly as:
You can add version information to any files that can have Windows
resources, such as DLLs, executable files, or .fon font files.
Which narrows the list of possible files to the list of files that may contain resources. Unfortunately, there is no (and cannot be) a list of extensions of files, that might contain resources, because you can have a file with version information having some exotic file extension (I've asked for it a long time ago).
So, there is no credible advice, for which files you should keep or remove this flag.
Is the "ignoreversion" flag really intended ? When should I use it ?
More it makes me wonder, why to include the ignoreversion flag. I would say it should be used rarely and carefully only there, where you are sure a possible downgrade of a certain file won't hurt. Without it, the Inno Setup compares version of the installed file with an existing one and replaces it when it's older, which is in my view the most wanted behavior.
The version flags refer to the version of your application installer package and not to the DLL version of a file shipped with the installer. Because of this .txt files also have a version and the 'ignoreversion' flag makes sense for any file within the installer package. It's up to the developer to trace and adjust the file updates between application versions using any of the InnoSetup provided flags.

Can I have more than one {app} variable in Inno Setup?

I am making an inno setup script. My setup really needs the user to choose to two customized install locations.
But there is only one {app} variable in inno.
Our software is an audio plugin software, the common way in this field is to choose one location for the program and the other location for audio sample/data (which is very large so users usually want to install at a dedicated place for storage and also performance purpose).
Is there any way to get around this condition?
Thanks a lot!
There are many other variables (Directory Constants) which you can use, most common ones:
{app} - The application directory (user chooses this derectory in Wizard dialog)
You can create subdirectories like {app}\Data
{win}
The system's Windows directory.
{sys}
The system's System32 directory.
{pf}
Program Files.
{cf}
Common Files.
And many, many others.
The modern installers store application in one directory - {app} and user's files in every user's custom directory - e.g. {localappdata}.
And if this is still not enough you can create your own dialog (wizard page) that contains edit boxes and Browse buttons for selecting directories.
Use function CreateInputDirPage() for this purpose.
See manual - Pascal Scripting: CreateInputDirPage for more info.
Take a look at the included CodeDlg.iss example that shows how to add an extra page for a data directory and hwo to use that value in [Code].

Could I control what to be uninstalled when uninstall one application in inno setup?

One quick question about inno-setup: Can I customize which files to be removed by uninstaller? As I know, the uninstaller always uninstall all the files created by installer. If the answer is Yes, what should I do for that?
My case is: After I install my application, directory "{pf}\myapp\" include some dlls, two executable files, and there created two desktop icons and uninstallers for each executable file. What I expect is user can uninstall each executable file, rather than all the files; and if it's the only executable file left, uninstaller will remove all the files.
Thanks in advance.
If you want separate uninstallers, you have to write separate installers. The general rule is you have to write a separate installer per application.
This said, you can have any number of shared files, which can be dll's, executables, etc. that are shared between distinct applications.
Windows have well defined procedures to keep track of shared files, with a reference count. The reference count is incremented by the installer and decremented by the uninstaller. The files are removed from the system only if the reference count reach 0 during uninstallation.
You use the sharedfile flag to instruct the installer the file is shared. The MyLib.dll file is shared in the following example:
[Files]
Source: "MyProg.exe"; DestDir: "{app}"
Source: "MyProg.chm"; DestDir: "{app}"
Source: "MyLib.dll"; DestDir: "{sys}"; Flags: sharedfile
Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme
From the documentation (emphasis mine):
sharedfile
Specifies that the file is shared among multiple applications, and should only be removed at uninstall time if no other applications are using it. Most files installed to the Windows System directory should use this flag, including .OCX, .BPL, and .DPL files.
Windows' standard shared file reference-counting mechanism (located in the registry under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs) is used to keep track of how many applications depend on the file. Each time the file is installed, the reference count for the file is incremented. (This happens regardless of whether the installer actually replaces the file on disk.) When an application using the file is uninstalled, the reference count is decremented. If the count reaches zero, the file is deleted (with the user's confirmation, unless the uninsnosharedfileprompt flag is also specified).

How can you harvest files for Inno Setup

I am trying to find a tool similar to heat for WiX that will allow me to harvest file and folder entries for Inno Setup. Is there anything available?
Edit: Heat is used to harvest installation artifacts (files, folders, registry entries, etc) from a machine and generate a WiX source file. I know Wise for Windows Installer had a wild card option that performed a similar function. I have not found anything similar for Inno Setup.
I am trying to include hundreds of files (dozens of folders) of sample projects and data to go with our application installation. These will change between releases and I was hoping to automate this portion of the installation authoring.
You can include an entire directory tree via wildcards and recursion, eg:
[Files]
Source: somewhere\root\*; DestDir: {app}\Data; Flags: recursesubdirs
(If you want to include empty directories as well, add the createallsubdirs flag too.)
There is no direct equivalent for registry entries, but eg. ISTool can convert a .reg file into the corresponding [Registry] entries.

Resources