I have used the following code for uninstalling my c# application through programmatically.
string[] arguments = Environment.GetCommandLineArgs();
foreach (string argument in arguments)
{
if (argument.Split('=')[0].ToLower() == "/u")
{
string guid = argument.Split('=')[1];
string path = Environment.GetFolderPath(Environment.SpecialFolder.System);
ProcessStartInfo si = new ProcessStartInfo(path + "/msiexec.exe", "/x " + guid);
Process.Start(si);
Application.Exit();
}
}
the code above i works fine and uninstalls my S/w correctly.
But my requirement is that how can i get the “Yes” button click event of that unistallation confirmation box.
You can play with params and use
quietorbasemodes to not interact with user at all. I’ve described this approach in answer here: How to show installer to the userIn case of using “base” mode (
msiexec /qb) user will see only progress bar without any questions.