How to support thousands of files using Inno Setup? - 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

Related

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

three components in three user defined locations

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.

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.

Install the same file to multiple destination folders in Inno Setup

Is it possible to define more than one destination folder in Inno Setup script?
example:
Source: "Test.exe"; DestDir: "{app}" // here I need a second folder
Thanks!
Why not add the file twice with differen DestDirs? Haven't tried, but should work. Otherwise it's hard to make a suggestion without knowing what exactly you're trying to achieve. There might be better ways, if only we knew what you're trying to do :-)

Resources