Santhosh J
Santhosh J

Reputation: 368

How to get the file name of the file which is being installed?

How to get the file name of the file which is being installed?

I want to check if the file being installed is already at the destination folder and rename the existing one to some other name. Is there a way where we get to know the file name of which is being installed? (around OnMoving() or so?).

Note: I am using InstallScript MSI - InstallShield 2011 Premier

Upvotes: 2

Views: 1259

Answers (2)

Michael Urman
Michael Urman

Reputation: 15905

While I think you can intercept file installation on a per-file basis in a pure InstallScript project, you cannot do it in the Windows Installer based InstallScript MSI project. This is because Windows Installer doesn't give that kind of hook. So if you want to do something like this, you will need to figure out which files will be overwritten ahead of time, and do what you want at that point instead of waiting for a per-file event.

Upvotes: 0

Bogdan Mitrache
Bogdan Mitrache

Reputation: 11023

You can try to read the filenames of the files that your package will install at run-time using a custom action and then check the install directory if it contains another file with a matching name.

Here are some examples of custom actions that can access the MSI database at install-time: http://msdn.microsoft.com/en-us/library/Aa372865

Upvotes: 1

Related Questions