I've created a setup file for my application, which works fine for new installations, but I now need to adapt it to handle upgrades.
I understand I should add DisableDirPage=auto under [Setup], so the user won't be prompted for an installation folder during upgrades?
I also do a few things in [Run]. How do I skip these actions when it's an upgrade?
Under [Files] I currently use a single line to install everything to the application folder:-
Source: "{#BuildOutputFolder}\*"; DestDir: "{app}"; Flags: onlyifdoesntexist recursesubdirs createallsubdirs
Firstly, I'm guessing this won't work during an upgrade as "onlyifdoesntexist" would prevent the EXE and DLLs from ever being overwritten, even with newer versions?
Secondly, there are certain files (e.g. configs) that get installed, but should never be overwritten during an upgrade. I'm guessing the current line isn't sufficient and I would need to replace it with a number of separate lines to achieve this functionality, e.g. one to install the EXE, one for the DLLs, and one for the configs (with "onlyifdoesntexist")?
Related
I have created an installer using Inno 5.5.9 and am installing a number of binary files that need to be marked as shared because a second installer could install a second program to the same directory and these files are common across the two programs.
I am marking the files with the flags 'sharedfile uninsnosharedfileprompt' but they are not removed on uninstall even if they are not in use.
In my testing I install the main program and then uninstall it immediately. The uninstall log says it is 'decrementing shared count' for these files but the shared count is not reaching zero. This is a 32bit program installed onto Windows 10.
#define SourceDirectory "..\bin2017\win32"
#define InstallPath "{app}\bin\Win32\"
[Files]
Source: "{#SourceDirectory}\*.dll"; DestDir: "{#InstallPath}"; Flags: ignoreversion sharedfile uninsnosharedfileprompt
What am I missing to make this work correctly? What could be preventing the uninstaller from decrementing the shared count to zero?
If you need any more info or code please let me know (this is my first question on the excellent site).
Thanks in advance.
The path in the original location has most likely some orphan reference.
I believe your code is correct and the installer behaves correctly. It's just a local problem with reference counting.
I have few SQL script files which have to run before installation begin. The reason is if SQL scripts run successfully only, I want to do the installation.
If the SQL scripts need to run after the installation, I can copy the files to {app} path and run the files from there. But the requirement is run the files before installation begins. I am confused. What is the best way of doing it?
Say for example if it is a single file I can put it under Files section and can use ExtractTemporaryFile('FileName');
But as I mentioned, I have many files (in SQLSCRIPTS folder). What is the better way? (One solution is I can make it as a single file by zipping it and then unzip it)
[Files]
Source: "C:\\SQLSCRIPTS\\*"; DestDir: "{app}"; Flags: dontcopy
To extract multiple files from installer, use the ExtractTemporaryFiles, like:
ExtractTemporaryFiles('*.sql');
I was using Inno Setup QuickStart Pack 5.5.6 and it was perfect.
I installed Inno 5.5.8 QuickStart Pack 5.5.8 and I'm having some problem.
If I start Inno Setup I can select appname, company and Ii can select path of the program and program exe file, so look this screen:
like you can see I selected the main .exe in \Binaries\Win32\ so it is located not in main folder of the program but in a sub-folder.
Now this is the code that I have
Inno Script studio automatically write the wrong exe path, it is not the main folder of the program but like I said already it is in \Binaries\Win32\.
But why it did this? I worked with Inno Setup QuickStart pack 5.5.6 and I never seen this problem, the correct path was correct also if the exe was in some sub-folder.
You have these two entries in the [Files] section.
[Files]
Source: "C:\temp\Life Is Strange Episode 5\Binaries\Win32\LifeIsStrange.exe"; \
DestDir: "{app}"; Flags: ignoreversion
Source: "C:\temp\Life Is Strange Episode 5\*"; \
DestDir: "{app}"; Flags: ignoreversion recursesudirs createallsubdirs
This does not make any sense. The entries overlap.
It seems you believe that by selecting the directory C:\temp\Life Is Strange Episode 5 in the "Other application files" setting you somehow miraculously define a mapping between the C:\temp\Life Is Strange Episode 5 and the {app} that should make Inno Setup Studio know that when you select the main application file C:\temp\Life Is Strange Episode 5\Binaries\Win32\LifeIsStrange.exe it should go to {app}\Binaries\Win32. It won't. The entries are not related to each other in any way.
So, the first entry will install the LifeIsStrange.exe directly to {app}.
The second entry will install a whole directory tree, including the LifeIsStrange.exe.
So you end up with LifeIsStrange.exe both in the {app} and the {app}\Binaries\Win32.
But the icon will point to {app}\LifeIsStrange.exe.
I believe the Inno Setup Studio does what you asked it to do.
If you want it to do something else, you have to set up things differently. Though I'm not sure the Inno Setup Studio allows you to install the main application executable anywhere else, but to the {app}.
To do what you ask for, you probably have to edit the .iss manually to be like:
[Files]
Source: "C:\temp\Life Is Strange Episode 5\*"; DestDir: "{app}"; \
Flags: ignoreversion recursesudirs createallsubdirs
[Icons]
Name: "{group}\{#MyAppName}"; FileName: "{app}\Binaries\Win32\LifeIsStrange.exe"
I want to call a function after installing a folder, but the InstallEnv function is seems to be called several times, maybe for each file is the folder (to be confirmed). Is there a way to call it only once after it installed all of those files? I can't use the Run section because I want to do error catching with the return code.
Source: "InputFiles\virtualenv-1.8.2\*"; DestDir: "{tmp}/virtualenv"; \
Flags: recursesubdirs; AfterInstall: InstallEnv;
There is no way to call it at the end of the installation of that group of files, from within a single entry. However it is possible to call the function at the appropriate time by making use of a dummy entry:
[Files]
Source: "InputFiles\virtualenv-1.8.2\*"; DestDir: "{tmp}\virtualenv"; Flags: recursesubdirs
Source: dummy.txt; DestDir: {tmp}; AfterInstall: InstallEnv
The Source file must exist but it can be a zero-byte file. As installation is into {tmp} it will be deleted after install anyway so its contents are irrelevant.
This works because [Files] entries are installed in the order specified.
Yes, it executes once per each file. The reference says about it (emphasized by me):
A BeforeInstall or AfterInstall function for a [Files] section entry
using a wildcard is called once per file matching the wildcard. Use
CurrentFileName to check for which file the function is called.
And no, there is no way to call it once after all the files are installed. If you were going to run it only once, it wouldn't be a problem, since you might declare a flag variable, indicating that the function was already called, but you want to detect if it's the last call, and for this there is no workaround.
Well, maybe if you would know, which file will be the latest installed from that folder, you might check that against the result of the CurrentFileName function call, but I doubt that you can determine which one will be installed as last at compilation time (since at runtime, there is currently no way to get list of files to be installed).
I have an app written in VB6 with a MDB database.
When installing the latest version if user has an older version than I would like to copy the old DB Folder(Program Files/AppName/DATA/) to the new installation instead of setting up the default DB.
The new version will be installed in a new folder Program Files/AppName2/DATA
if datafolder exists in program files/appName/DATA
copy datafolder to Program Files/AppName2/DATA
Any suggestions ?
Thank you
I'm not sure why you're asking this, as it is similar to your previous question which I have provided a solution for. Just use the DirExists and FileCopy functions.
Source: "{pf}\App\Data\*.*"; DestDir: {code:DataPath}\; Check: DirExists(ExpandConstant('{pf}\App\Data\')); Flags: ignoreversion recursesubdirs external