You can use msiexec.exe. You can simply uninstall an application with its product code
. Using command you can set whether to show UI during the uninstallation or make it a silent uninstallation,
string UninstallCommandString = "/x {0} /qn";
- /qn: Set user interface level: None
- /qb: Set user interface level: Basic UI
- /qr: Set user interface level: Reduced UI
- /qf: Set user interface level: Full UI (default)
C# code
string UninstallCommandString = "/x {0} /qn";
Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
process.StartInfo = startInfo;
startInfo.UseShellExecute = false;
startInfo.RedirectStandardError = true;
startInfo.FileName = "msiexec.exe";
startInfo.Arguments = string.Format(UninstallCommandString, "Product Code");
process.Start();