Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > How to - Call Uninstall method in ServiceProcessInstaller for WindowsServiceApplication using MSI
 

How to - Call Uninstall method in ServiceProcessInstaller for WindowsServiceApplication using MSI

Hi,

I have a Deployment project which creates an MSI setup file to install a service. (VB .NET)
I have a reference to another project which is a win form application and has a setup form which takes the user name, password and some other settings information which will be used by a service. It has "Finish" and "Cancel" buttons.
I am creating a new instance of this form on Sub New() of the ProjectInstaller Class, so user can input information, click Finish and installation completes. The service is then automatically started.
Now, when I click Cancel on the settings form, I am not able to exit out and halt the installation process. Instead it installs the service !!

How can I use the Rollback or Uninstall methods to do the task?

I was trying this -
On cancel_click, set boolean var cacelStatus = True
On Sub New() method of ProjectInstaller class, I am checking - If true - uninstall, else - install

How can I achieve this?

Thanks in advance!

Regards!
Vishal Sheth
Vishal_MSDN  Thursday, August 13, 2009 7:11 PM
The issue is that all custom actions run after all the files are installed, and there's also a sequencing issue. You've got your form before the service installer custom action?
In general, the MSI architecture does not expect anyone to run a Windows message pump in the install process custom actions. People have detoured this by firing off an MTA thread for the form. What you're supposed to do is collect that information up front with one of the extra dialogs you can add, and then store those items in the registry (using the IDE) by saving them as [MYPROPERTYNAME], or whatever the property is called.
Phil Wilson
PhilWilson  Friday, August 14, 2009 7:39 PM
The issue is that all custom actions run after all the files are installed, and there's also a sequencing issue. You've got your form before the service installer custom action?
In general, the MSI architecture does not expect anyone to run a Windows message pump in the install process custom actions. People have detoured this by firing off an MTA thread for the form. What you're supposed to do is collect that information up front with one of the extra dialogs you can add, and then store those items in the registry (using the IDE) by saving them as [MYPROPERTYNAME], or whatever the property is called.
Phil Wilson
PhilWilson  Friday, August 14, 2009 7:39 PM
Correction - when I said MTA thread I should have said STA thread. A windows message pump runs in an STA.
Phil Wilson
PhilWilson  Monday, August 17, 2009 11:13 PM
Thanks Phil for the inputs, but for now we will go with throwing (New) InstallException and modifying the dialog (error) box with custom message using ORCA.


Vishal Sheth
Vishal_MSDN  Friday, August 21, 2009 8:28 PM

You can use google to search for other answers

Custom Search

More Threads

• Registry access with non-Admin
• VS2008 ClickOnce insists on re-installing framework
• Conditionally Installing Registry Keys
• Deleting Application specific User related ISolatedStorage during uninstalling
• ClickOnce app not recognized as one
• Removing signing on ClickOnce manifests
• Delete File after MSI Install
• Application with different images each time.
• Setup Wizard banner text
• The persistUpdateCheckResult wasn't added to the CheckForUpdateAsync ??