- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Delete generated files during rollback
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Delete generated files during rollback
I have a basic MSI that installs and starts a service, which generates files and folders in the install directory. I have a deferred custom action with synchronous return processing (checking exit code) that checks for the existence of one of these files. If this file doesn't exit, the custom action will return an error, and the installation will roll back.
The files and folders that got generated by the service also need to be deleted during rollback, so I followed the steps here to do that: http://helpnet.installshield.com/installshield21helplib/helplibrary/AccessingProps-DeferredCAs.htm. I?m trying to get the value of INSTALLDIR in the below MSI DLL custom action, but it doesn't seem to be working because when I do an MsiGetProperty of INSTALLDIR and display a message box with this value, it's empty.
Here's what I did:
INSTALLDIR is listed in SecureCustomProperties
Set Property Action
Custom Action Name: SetCAData
Property: RemoveGeneratedFiles
Property Value: [INSTALLDIR]
Return Processing: Synchronous (Check exit code)
Execution Scheduling: Always Execute
Install Execute Sequence: After InstallInitialize
MSI DLL Custom Action
Custom Action Name: RemoveGeneratedFiles
Function Name: RemoveGeneratedFiles
Return Processing: Synchronous (Check exit code)
In-Script Execution: Rollback Execution in System Context
Install Execute Sequence: After SetCAData
Here are some snippets from the install log:
Rollback: RemoveGeneratedFiles
MSI (s) (F0:54) [07:12:01:514]: Executing op: ActionStart(Name=RemoveGeneratedFiles,,)
MSI (s) (F0:54) [07:12:01:514]: Executing op: CustomActionRollback(Action=RemoveGeneratedFiles,ActionType=3329,Source=BinaryData,Target=RemoveGeneratedFiles,CustomActionData=C:\Program Files\Your Compay Name\rollback\)
...
Property(S): INSTALLDIR = C:\Program Files\Your Compay Name\rollback\
Does anyone have any advice on how to remove these generated files during rollback?
Thanks in advance.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Try putting that action prior to InstallInitialize.
In RemoveGeneratedFiles, the property you should be referencing in MsiGetProperty is "CustomActionData" (not INSTALLDIR). The only properties that are available to deferred custom actions are "ProductCode", "UserSID", and "CustomActionData". Attempts to retrieve any other properties will return a null string.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Thanks again!