You can create a custom action to access a file that will be installed on the destination computer by the current installation. However, it is important that the file is installed properly on the destination computer before your custom action attempts to use it. Most developers feel that placing the custom action after the InstallFiles action is good enough. In most cases, this is not true.
You can access a file that is already on the computer or a file that is being installed by the package by using a custom action in the product. Many of the custom actions end with From "Installed Files, Destination or Property". In any case, the following procedures should help you correct some errors caused when accessing a file.
The first possible solution to an error thrown during installation when these custom actions are used (and the one recommended for most situations) is to set your custom action's In-Script Options field to deferred execution. This holds execution of the custom action until the end of the installation sequence. This method should work in most situations because it sets the action to be executed when the queued installation script is executed so it is executed late in the installation after most of the actions have already completed.
The solution above might not work in all situations. If your custom action needs to access properties or table entries in the .msi, deferred execution might not work. In this case, the required files must be installed successfully prior to executing your custom action. To do this, place the custom action after InstallFinalize in the Execute Sequence.
If you cannot place the custom action after InstallFinalize, you must force the installation of the files in the queued installation script prior to your custom action. Windows Installer provides two built-in actions that let you force the execution of all queued installation processes between InstallInitialize and InstallFinalize. These actions are called InstallExecute and InstallExecuteAgain.
To add an InstallExecute or InstallExecuteAgain action:
Now when you run your installation, all of the installation sequence actions prior to your custom action will be executed.