Making Your Own Uninstall (Since there is no way to get a shortcut in your Setup)

Submitted on: 1/2/2015 7:27:00 AM
By: N. Kusters (from psc cd)  
Level: Intermediate
User Rating: By 7 Users
Compatibility: VB.NET
Views: 1684
     Let's you launch the uninstall for your application from within your app

This article has accompanying files
				For better/easyer reading, i just zipped a text file with some better fortmatting. Article below:
I have been searching my a-s-s off to get a nice uninstall shortcut in my start menu for my own programs. But the setup and deployment does not allow me to.
Here is what i did:
Make a setup for your program with the .NET tool, in it's properties, you see a product code (for my prog it's {75FE729D-69D4-4B86-9010-052770DE341F} for example).
In the add/remove programs window in your software window, your app is listed, and if you click remove, it's launched this way:
system32 dir \ MsiExec.exe /I{product code}
so, to do this yourself, in your application, you can do this:
Private Sub Uninstall()
 Dim myProcess As Process = New Process
 Dim s As String
 ' get the System path
 Dim sysFolder As String = _
 System.Environment.GetFolderPath _
 ' set the file name and the command line args
 myProcess.StartInfo.FileName = "cmd.exe"
 myProcess.StartInfo.Arguments = "/C cd " & _
 sysFolder & " && MsiExec.exe /I{75FE729D-69D4-4B86-9010-052770DE341F} && exit"
 ' start the process in a hidden window
 myProcess.StartInfo.WindowStyle = _
 myProcess.StartInfo.CreateNoWindow = True
 ' if the process doesn't complete within
 ' 0.5 second, kill it
 If Not myProcess.HasExited Then
 End If
End Sub
Now, you have launched a CMD windows, that launches the uninstall for your application.
Hope it helped.

winzip iconDownload article

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net

Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Intermediate category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

 There are no comments on this submission.

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)

To post feedback, first please login.