uninstalling itself

LwSiX

New member
Joined
Sep 14, 2008
Messages
4
Programming Experience
1-3
Hello there, it has now come to a point where i would like to implement an "auto-update" feature in my windows service - but i am having issues getting the service to uninstall itself like so:

VB.NET:
With oProc.StartInfo
     .UseShellExecute = False
     .RedirectStandardOutput = True
     .CreateNoWindow = False
     .RedirectStandardError = True
     .FileName() = "msiexec"
     .Arguments() = "/quiet /uninstall {ABF82AAA-4D7B-4DDD-827E-7D47E5A3CB02}"
End With

oProc.Start()

But for some reason it just doesnt work, ive put it in a form application and it works no problem, but not in a service. How can i solve this problem?

I have also tried outputting the command into a .bat file and executing that but that also doesn't work...i think it might be because of the SYSTEM account permissions but im not sure.

Thanks in advance!
 
Update: having the process run as my Administrator account does absolutely nothing either.... any thoughts??
 
When you build the installer for the new version, there is a property you can set to un-install the previous version. By setting the 'RemovePrevious' property, the new installer will take care of un-installing the previous version before installing the new version.

Given that this is a windows service, I don't know if you have to manually make sure the service is stopped before the installer tries to remove it or if the installer will stop the service on it's own.

Also, are you running this on Vista? That could be the reason the admin account stuff is such a pain.
 
Thanks for the reply and suggestion. I actually do have that set but I'm a little confused because when i increment the version number - it recommends that i change the product code. I don't think that makes alot of sense, i thought the product code is what it used to identify the product and the upgrade code was for the version?
 
The upgrade code is the same, but a program with different version numbers are actually two different products.

Like Office 2003 and Office 2007, two different versions of the same product so two different product codes, and doing an upgrade they'd need the same upgrade code to identify each other.
Behind the scenes of the installer, I don't know how it actually knows/does the versioning, but it does and I've had many projects that use this installer without problems.
 
Thanks for your help, seemed to work right up until the new package came up and said "Error 1001: The Specified Service already exists". I thought it was supposed to uninstall it? Oh well. I also tried running msiexec /uninstall /quiet {guid} from within the OnBeforeInstall action but that nicely errors out as well by saying "a current installation is already pending". I just cant win. :mad:

I also read that MS changed the way the MSI uninstalls work for 2008, instead of uninstalling the old product first, it does it last. Brilliant idea whom ever that was.
 
I also read that MS changed the way the MSI uninstalls work for 2008, instead of uninstalling the old product first, it does it last. Brilliant idea whom ever that was.
Where did you read that? I'm not finding this information with google searches.
 

Latest posts

Back
Top