How do I abort a Setup Project install from a WPF custom action dialog?
I have a WPF window that is shown as a custom action as part of my VS Setup Pr开发者_如何学运维oject installation. This works well, but I can't figure out how to inform the installer if the user presses the cancel button on the dialog that I'm popping up, so that it rolls back the install. Is there a way that my dialog can provide input to the installer? I'm just referencing the WPF project's DLL, set as a non-installer class in a custom action.
A DLL or VBScript custom action can stop the installation by returning 1602: http://msdn.microsoft.com/en-us/library/aa369778(v=vs.85).aspx
Assuming that you can get an installation handle (PMSIHANDLE) in your custom action, you can use DoAction function to run a simple DLL custom action which returns 1602.
You can make a public variable in the form and store in it the state of the form and check on it in the installerClass
after the ShowDialog()
.
精彩评论