Existing User Specific File not Overwritten - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

brenda
Posts: 3
Joined: Thu Dec 10, 2009 9:26 pm

Existing User Specific File not Overwritten

Hello,

I followed the instructions in the Help topic entitled "How do I install an user specific file?", to install a file external to the .msi package. In addtion, on the created SOURCEDIR Folder properties, I checked the "Ensure that all files in this folder overwrite any installed target files" in the File Options. However, when there is an existing file of the same name in the destination, it is not overwritten. The existing file happens to be newer that the install file, but I want to overwrite it in all cases.

Is there something else I need to do?

Thanks for your help,
Brenda
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Existing User Specific File not Overwritten

Hi Brenda,

The file copy operation does not take into account the flag you are setting ("Ensure that all files in this folder overwrite any installed target files"). Therefore, the reason the installed file is not being overwritten is it being newer than the file you are trying to replace it with.

You can only overwrite that file using a custom action, such as a Launch File or Open URL custom action, with the Command Line field containing something like:

Code: Select all

cmd /c copy <source_file_path> <destination_file_path>
Replace <source_file_path> and <destination_file_path> with the proper paths.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
brenda
Posts: 3
Joined: Thu Dec 10, 2009 9:26 pm

Re: Existing User Specific File not Overwritten

Hello Gabriel,

Thanks for the tip. This is what I did:

I created a new Custom Action under the "Install" category.
The Custom Action type is "EXE with Working Directory and path given by a Formatted."
The Working Dir is "AppDataFolder".
The Full Path is:
"[%ComSpec]" /C COPY "[SOURCEDIR]\info.db" "[AppDataFolder]\[Manufacturer]\[ProductName]"
Everything else is left at default.

This works as desired on the initial install - it copies the info.db file even if it already exists.

However, if there is an attempt to run the install again, the copy does not execute. To get it to execute everytime, in the "Execution Condition" I changed the default Expression of "Not Installed" to "1=1". Again the initial install works correctly, but this causes a problem when there is an attempt to reinstall. Windows installer displays the "Modify, Remove, or Repair installation" dialog. If "Repair" is chosen, the install fails with an error message box stating "A program run as part of the setup did not finish as expected." This also corrupts the Uninstall process, which will consistenly fail with the same error message. The application must be then removed from the registry manually using regedit.

My goal is to just have this separate info.db file installed each time the install is run - regardless of its timestamp, an existing file, or a reinstall. Your help with any other suggestions is greatly appreciated.

Thanks,
Brenda
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Existing User Specific File not Overwritten

Hello again Brenda,

It is important to know that, when installed, an .msi is also copied to the Windows Installer Cache. The repair/remove options will run the .msi from that location. This means the SOURCEDIR property will evaluate to that location, thus not being able to find [SOURCEDIR]\info.db. As a result, the "copy" custom action would fail unless you set it as "Synchronous execution, ignore return code". But this would not reinstall info.db in case of a repair.

You could try placing info.db in [WindowsFolder]Installer\[ProductCode] during install and copy it from there if the installer can not already find it right next to it, as is the case of a repair. This should reinstall info.db properly.

However do not forget to remove info.db during uninstall both from the installation directory and from the Windows Installer cache. As this file is not registered with Windows Installer, it will not be removed automatically.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
brenda
Posts: 3
Joined: Thu Dec 10, 2009 9:26 pm

Re: Existing User Specific File not Overwritten

Thanks Gabriel - that would work if I wanted the original file installed each time. However, the reason that the file is separate from the .msi is that I need the client to be able to update the info.db file and have it reinstalled, without me having to rebuild the .msi for them each time. Is there some way I can get Windows to always do an install and never a repair?

Thanks so much for your help,
Brenda
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Existing User Specific File not Overwritten

Hi Brenda,

On the "Product Details" page in Advanced Installer, you can check the "Disable Repair" and the "Disable Modify" options. This will prevent a user from initiating a modify/repair from the Add/Remove programs utility, thus the cached version of the installer will never be used. The only way those actions can be initiated will be through the original installer, thus the updated version of the database will be installed.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”