Tushar
Posts: 16
Joined: Thu Sep 28, 2017 1:48 pm

Backup of file before updating to new version

Hi,

I want to copy a file from current APPDIR to APPData/<application> folder before upgrading to the newer version. I have tried the below solution but its not working for me. Perhaps I am doing something wrong in implementation?

viewtopic.php?f=5&t=27779#p70508

aip file attached herewith.

I have added both the source and destination directories in search. The test search works fine. It gives me what directories I want but then the file does not get copied to the destination.

Please note that I have no administrator privileges on the test system (Similar to user's system).
Backup_filecopy.aip
aip file. file copy has the same one liner code
(72.03 KiB) Downloaded 255 times
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Backup of file before updating to new version

Hello Tushar,

I've reviewed your setup projects and I have two observations:

1. go to "Files and Folders" page and double click on your "userdic.tlx" file from "Application Data\ExpressEditor" folder; go to "Operations" tab and use the following condition for the "Do not overwrite existing file" option:

Code: Select all

OLDPRODUCTS
this way the file won't be installed during a setup product upgrade.

2. go to "Custom Actions" page and move your custom action in the "Install Execution Stage" sequence just after "Searches" action group; this way the old file will be copied before the old product being removed during the "Preparing" action group (more exactly during the "RemoveExistingProducts" action)

If this is still of no help, then please do send us the AIP (project file) of your old product version too and a detailed test case we can use to replicate the behavior you are encountering.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Tushar
Posts: 16
Joined: Thu Sep 28, 2017 1:48 pm

Re: Backup of file before updating to new version

Thanks much for responding, Daniel.

I will explain the situation here. I already have a version built using AI out in production for this product. Say the version is 5.10. There is a bug in 5.10. A custom user dictionary file which is updated by the users during their work is a part of 5.10 setup. When I give the next version update, the user dictionary file is getting overridden by the default file in new updated setup. Users are losing their updated data. Thus, before updating the application, I want to take backup of the previous file and put it in APPDATA/ExpressEditor folder where it can stay permanently and will not be overridden. 5.11 will access the file from that location thereafter. I just want this change to be temporary (only for this update).

I prepared 5.11 release with your instructions.

1. I changed the userdict.tlx "Do not override existing file" condition under operation tab to

Code: Select all

OLDPRODUCTS
2. moved my
CopyToTempDir
custom action just after the Searches group in Install execution stage.

But still the userdict.tlx file is not copied to the location. and I get update failed message. The old version is uninstalled but the new one is not installing.

I am sending both AIP files as an attachment with separate email to you on support@adv.

Thanks,
Tushar
Tushar
Posts: 16
Joined: Thu Sep 28, 2017 1:48 pm

Re: Backup of file before updating to new version

Hi Daniel,

When I tried installing the new version on top of the older version by manually executing the MSI file, it worked and copied the file on the destination.

Same thing is not working when I give update of the application.

I am attaching the update aip file in the email for your review.

Thanks,
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Backup of file before updating to new version

Hello Tushar,

This may happen because your Updater tool is configured to install updates without elevation. In this case the updates setup (v5.11) will be launched under LocalSystem account and must run completely silent.

Can you please go to "Custom Actions" page (of your v5.1. setup project) and check the "Hide program's window" option for your copy file custom action?

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Tushar
Posts: 16
Joined: Thu Sep 28, 2017 1:48 pm

Re: Backup of file before updating to new version

Hi Daniel,

I have tried this "Hide Program's Window" option but it still fails. Is there any other way of doing it. As you understood correctly the issue is only with the updates. when I tried manually overriding the application, it worked correctly.

Could you please suggest?

Thanks,
Tushar
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Backup of file before updating to new version

Hello Tushar,

In order to further investigate this we will have to replicate the behavior on our side. Could you send us by email to support at advancedinstaller dot com a download link for your old setup and for the new setup package so we can fully test and investigate this on our side?

If you cannot share with us your setup files, then you can try to isolate the behavior in a buildable sample (.aip + its referenced files) which we can build and test on our side.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Tushar
Posts: 16
Joined: Thu Sep 28, 2017 1:48 pm

Re: Backup of file before updating to new version

Hi Daniel,

I have shared a sample project with you through email. Could you please check?

Thanks,
Tushar
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Backup of file before updating to new version

Hello Tushar,

I am afraid we did not receive (or I am unable to identify it in our Inbox) any sample for this issue from you.

Can you please get back to me with more details by email about how can I access your sent sample? I've also sent you a follow up email about this.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Tushar
Posts: 16
Joined: Thu Sep 28, 2017 1:48 pm

Re: Backup of file before updating to new version

Hello Daniel,

I have tried the ways you have mentioned in the ticket but it still fails to copy files. I cannot share the setups with you but I have created similar build with sample project.

PFA project.

1. Project Name: FileCopy
2. FileCopy 1.0.0, AIP file (Old Setup simulation): FileCopy.aip
3. FileCopy 1.0.1, AIP file (New Setup simulation), this should contain the file copy custom action: FileCopy-custom-action.aip
4. Update preparation for new setup: FileCopyUpdates.aip
5. Mail.jar file is to be copied from the <old_installation>/lib folder to current user’s AppData/Roaming/TestApp/ folder
6. Batch to copy mail.jar file: fileCopy.bat

Please let me know if you have any queries.

Thanks,
Attachments
fileCopy.zip
(29.62 KiB) Downloaded 234 times
Tushar
Posts: 16
Joined: Thu Sep 28, 2017 1:48 pm

Re: Backup of file before updating to new version

Hello Daniel,

Do you have any update on this issue? I have sent an email to you as well. Could you please look into this?

Thanks,
Tushar
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Backup of file before updating to new version

Hello Tushar,

I've tested and replicated the behavior. This happens because the Updater is configured to launch the updates setup without elevation, thus in this case the updates setup is running under LocalSystem account.

Thus the searches you configured in "Search" page will fail because the "AppDataFolder" folder will be redirected to appdata of System account and the "Path" registry will be searched under the HKCU hive of System account.

You have two options:

1. save the Path registry under a per-machine HKLM hive and copy the jar file under a per-machine location (e.g. CommonAppDataFolder) or
2. do not use the "Install Updates without elevation" option

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Tushar
Posts: 16
Joined: Thu Sep 28, 2017 1:48 pm

Re: Backup of file before updating to new version

Hello Daniel,

I have tried giving the complete absolute path in the command line like this - "C:\Program Files (x86)\YourCompany\FileCopy\lib\mail.jar" "E:\Testing\" but it still does not work. I have eliminated the search options here. I have also tried to put the same path into the fileCopy.bat file directly but no results.

It works only if the elevation is enabled. I cannot enable the elevation. My users does not have admin privileges.

Any other suggestions?

Thanks,
Tushar
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Backup of file before updating to new version

Hello Tushar,

Then the only solution I can think of is to try not to use installation location for your jar file which require elevation. Have you tried to use the "CommonAppDataFolder" as target installation folder?

If this is still of no help, then please try to give me more details about your scenario requirements.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Tushar
Posts: 16
Joined: Thu Sep 28, 2017 1:48 pm

Re: Backup of file before updating to new version

Hello Daniel,

I have tried putting it in the commonAppData Folder (Which is actually not desirable for my scenario) but that too didn't work.

I will explain the complete scenario.

The file which I want to move is an user dictionary file for our editor application. The user dictionary should be stored by each user in their local domain. Thus, I need it to be in the current user's app data folder.

In my existing application which is already installed on several user's computer, the user dictionary file is in the current installation folder. when I given an update of the application the updated user dictionary file will be deleted during the uninstall and the new (rather default/empty) user dictionary file will be placed into the installation directory. The user will lose his/her updated dictionary file.

Thus, I want to

1. Copy the user dictionary file from the current installation folder and put it to the APP DATA folder.
2. Then let the AI program uninstall the current application and install the new one.
3. In short I want to take a backup of the user dictionary file from the existing installation folder and store it into Current user App Data folder.
4. Actually I am planning to keep the user dictionary file into the App Data folder from the next version onward.

Thanks,
Tushar

Return to “Common Problems”