Hi,
This could be done by monitoring through a file or registry entry the number of times the package is launched. When the package runs for the first time, it should execute a
custom action. For a registry value, the custom action should work like this:
- determine if the target registry entry exists
- if it doesn't exist then create it
- if it exists modify it to increase the number of recorded launches
- determine if the maximum number of launches was reached and set an
installer property accordingly
This custom action can be scheduled under the "InstallUISequence" -> "Begin" standard action. While the SHIFT key is pressed, drag and drop the custom action under "InstallExecuteSequence" -> "Begin" to share it between the two standard actions. Also, in the
Custom Action Properties page you should set the "Execute only once if present in both sequence tables" option.
The property set by the custom action can be used as a
custom launch condition. For example, the property can be set to "Launch" if the number of launches was not exceeded and to "No" if the package must not be launched. This can be verified by the custom launch condition to stop the installation and show a custom message to the user if the number of launches was exceeded.
Regards,
Cosmin
FOLLOW US
Get the latest news in Application Packaging