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!

mbevan
Posts: 3
Joined: Thu Sep 25, 2003 6:30 am

Deleting Files Before Install Custom Action (Again ;)

I have seen people asking about removing files before installation and/or after removal and the response is almost always "You can do this with a Custom Action." The problem being, I have yet to find any example of said Custom Action - VBScript or otherwise. I'm thinking, it's high time someone or, even better, a group of poeple, come up with something which could reasonably be called a standard Custom Action to do this.

If anyone has links (or can copy and paste the code they have used), I would be very, very grateful. I've been wrestling with this problem for three hours now - and it's 1:30 in the morning now.

I'm thinking, a good solution for this would require several generic "handlers" and a calling function which the MSI itslelf calls (after assigning appropriate session variables). (Note: I know next to nothing about Custom Action programming for MSI. In fact, I use Advanced Installer because I know nothing about MSI. Nor do I feel I should have to.)

Handlers
  1. MSIRenameFile
  2. MSIDeleteFile
  3. MSIBackupFile
  4. MSIMoveFile
These would optionally confirm with the user ("Do you wish to backup files which may be overwritten?"), automatically create backup directories, etc.

I want to be able to write something as simple as:

Code: Select all

Function PreInstallBackup()
  MSIBackupFile("TARGETDIR", "lookups.db2", true)
  MSIBackupFile("TARGETDIR", "userdata.db2")
End Function
The first command asks for confimation, and the second remembers the setting (i.e. doesn't backup if the user previousally said "No").

Just some ideas, but I do need some solution... fairly soon. The product shipped yesterday. ^__^;
Cata
Posts: 638
Joined: Thu Apr 10, 2003 7:37 am
Contact: Website

The problem is that when you write Custom Actions, you do need to know quite a lot about MSI and Windows Installer.

We will try to make the process smoother, easier to use and add tutorials. But until then, my best advice is reading the Windows Installer SDK in MSDN.

Regards,
Cata
Catalin Rotaru - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mbevan
Posts: 3
Joined: Thu Sep 25, 2003 6:30 am

So no-one has any examples of removing a single file before installation?
Jarno Lepistö

It's shame.. This would help many users.
Cata
Posts: 638
Joined: Thu Apr 10, 2003 7:37 am
Contact: Website

Hello,

The next version of AdvInst (2.5) will contain dedicated support for file removal, using the Windows Installer standard actions.

A set of tutorials for Custom Actions, including source code, is also in the works.

All the best,
Cata
Catalin Rotaru - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”