I am developing an desktop based application using VB.NET, similar to add/remove program. everything was working fine until i start working on uninstall feature.
Now what am i doing is that i get the uninstall string of the specific application from the registry and use System.Diagnostics.Process to run UninstallString.
Dim proc As New Process()
proc.StartInfo.FileName =UninstallString
proc.Start()
proc.WaitForExit()
proc.Close()
latter i found that it only work for straight file paths only, i mean with no command line argument like:
C:\program files\someApp\uninstall.exe
I make a list of list of all UninstallStrings of all application installed on my machine. i found few things like application installed using MSI, some were with rundll32 and few were with straight file path with some command argument like:
My Silverlight SDK UninstallString, MSI Example
MsiExec.exe /X{2012098D-EEE9-4769-8DD3-B038050854D4}
My JetAudio UninstallString, RunDll32 Example
RunDll32 C:\PROGRA~1\COMMON~1\INSTAL~1\engine\6\INTEL3~1\Ctor.dll,LaunchSetup "C:\Program Files\InstallShield Installation Information{91F34319-08DE-457A-99C0-0BCDFAC145B9}\Setup.exe" -l0x9
My Google Chrome UninstallString, straight file path with command argument example
"C:\Program Files\Google\Chrome\Application\5.0.375.55\Installer\setup.exe" -uninstall
The code i mentioned above does not work for these. i did some string parsing, separate two thing from UninstallString one is Filename and other is Arguments. like for MSI, filename is MSIEXEC.EXE and argument will be rest of the string, same for RunDLL32, same for straight file path with command argument.
Now what am i facing is that, after every 2 or 3 days i come to know that this type of unistallstring is also not working. and why is that not working because it is a new type maybe abc C:\program files\someapp.exe -ddd so parse it too.
is there any better way of doing that rather then parsing the string.
i posted this same issue on MSDN forum too and got answer. Anyone need help visit the link below
http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/207c145a-60ff-4d68-878d-d0139b2b274c
Thanks