How do I uninstall another MSI package when my application is uninstalled?Answer
If your installation package includes some MSI-based prerequisites you may want to remove them when your application is uninstalled. For this you can use a custom action:
Since we don't want to uninstall applications on the target machine without the user's permission, you can use a custom action which prompts the user. The custom action can look like this:
Function Ask
MsiMsgBox("Do you want to uninstall the prerequisites?")
End Function
Function MsiMsgBox(msg)
Const msiMessageTypeUser = &H03000000
Const msiMessageStatusYes = 6
Set record = Session.Installer.CreateRecord(1)
record.StringData(0) = "[1]"
record.StringData(1) = CStr(msg)
ans=Session.Message(msiMessageTypeUser + vbYesNo, record)
If ans=msiMessageStatusYes Then
Session.Property("UNINSTALL_PREREQ")="YES"
Else
Session.Property("UNINSTALL_PREREQ")="NO"
End If
End Function
This VBScript custom action shows a message box which asks the user about uninstalling the prerequisites. Also, it sets the UNINSTALL_PREREQ property to the answer given by the user. You can schedule this custom action under the "InstallExecuteSequence" -> "InstallFinalize" standard action as Immediate. Also, the condition of the custom action should now be: REMOVE="ALL" AND UNINSTALL_PREREQ="YES" | |
| Privacy Policy | Windows Installer | Search Engine Ranking | Link Analyzer | ||
| © 2002 - 2008 Caphyon Ltd. Trademarks belong to their respective owners. All rights reserved. | ||