Hi there, I didn't find an answer to this question in the docs.
I know we can set 'project.overwritePolicy' to "onlyIfNewer", to avoid overwriting a distribution file with a more dated version of it.
But that assumes that the destination file has the same name, but different timestamp. Right?
What happens if instead of overwriting it, the newer destination file changed its name ? e.g. it has a version number in its file name
In my case, we make different installers for different products that goes inside a common folder, and there's a unique Activation executable for all the products.
Each installer drops the Activation executable to the common folder, and in case the installer is more dated it installs the product but doesn't overwrite the Activation executable. (For this purpose 'project.overwritePolicy' to "onlyIfNewer" just works OK)
But now the Activation executable needs to have a version number in its name. In this scenario, instead of overwriting a file we need to remove the older one and drop the new one.
For example.
Is this possible ? There is some example on how to achieve this using InstallBuilder ?
Thank you in advance for any help and paying attention to this problem,
Sebastian
Thank you for your help,
We have N independent individual installers that we release on different dates.
And we have 1 single common file Activation.exe for all the N products, which comes with the individual installers, which after installing all the files of the product it just drop the file Activation.exe into the common folder.
Right now we use "overwritePolicy.onlyIfNewer" for that single file, so if costumer installs an old product, it keeps the Activation.exe up-to-date. It's working OK.
Notice the rest of the files of the individual installers use the default overwritePolicy.Always.
But now we need to include version number at the fileName level for the Activation file, e.g. Activation.2020.01exe , Activation.2020.02.exe , etc
How would you face that situation in the individual installers?
'overwritePolicy.onlyIfNewer' assumes the destination file have the same name ("Activation.exe"). which is not the case anymore here, if the names include version numbers. Right ?
I would like to keep only the latest Activation.XXXX.YY.exe installed on the common folder and clean up the older ones, even when installing a more dated product.
Is that possible?
Thank you again for you dedication !
Sebastian
Hi @SebastianB1,
Can you give us more information about your specific scenario? Depending on how many files you expect to update from one version to the next one you could use the update installer or a regular installer acting like an update installer.
Please find below an example of what I mean here:
You can get more information about this in our docs in the next link
https://clients.bitrock.com/installbuilder/docs/installbuilder-userguide.html#_using_normal_mode_whe...
Thank you for your help,
We have N independent individual installers that we release on different dates.
And we have 1 single common file Activation.exe for all the N products, which comes with the individual installers, which after installing all the files of the product it just drop the file Activation.exe into the common folder.
Right now we use "overwritePolicy.onlyIfNewer" for that single file, so if costumer installs an old product, it keeps the Activation.exe up-to-date. It's working OK.
Notice the rest of the files of the individual installers use the default overwritePolicy.Always.
But now we need to include version number at the fileName level for the Activation file, e.g. Activation.2020.01exe , Activation.2020.02.exe , etc
How would you face that situation in the individual installers?
'overwritePolicy.onlyIfNewer' assumes the destination file have the same name ("Activation.exe"). which is not the case anymore here, if the names include version numbers. Right ?
I would like to keep only the latest Activation.XXXX.YY.exe installed on the common folder and clean up the older ones, even when installing a more dated product.
Is that possible?
Thank you again for you dedication !
Sebastian
Hi,
I think you can look for the existing Activation.{version}.exe file and extract it
<preInstallationActionList>
<findFile>
<baseDirectory>${installdir}</baseDirectory>
<pattern>Activation.*.exe</pattern>
<variable>installedFile</variable>
</findFile>
<setInstallerVariableFromRegEx>
<pattern>^.*Activation.([0-9]{4}.[0-9]+).exe</pattern>
<substitution>\1</substitution>
<name>installedFileVersion</name>
<text>${installedFile}</text>
</setInstallerVariableFromRegEx>
</preInstallationActionList>
And then compare this version with the one from the file you are going to deploy. You can do it in the actionList of the folder that unpacks the Activation.{version}.exe file:
<actionList>
<if>
<conditionRuleList>
<compareVersions>
<version1>${installedFileVersion}</version1>
<logic>less</logic>
<version2>${project.version}</version2>
</compareVersions>
</conditionRuleList>
<actionList>
<deleteFile>
<path>${installedFile}</path>
</deleteFile>
</actionList>
<elseActionList>
<deleteFile>
<path>${installdir}/Activation.${project.version}.exe</path>
</deleteFile>
</elseActionList>
</if>
</actionList>
Hope it helps,
Gonzalo