I have an installer project for VS 2019 and it has a product code + update code available, so in my application I am using it to uninstall the application programatically. Everywhere I looked this appears to be the right way to call msiexec and provide the product code but all I get is a popup window with info style output for msiexec and error code 1603. Even running it myself via powershell it does the same thing so is this no longer the correct way to uninstall something via command line? I would be happy to get it working in command line and can easily update code as well but nothing is working at the moment.
Referenced several other forum posts, codeproject site solutions, maybe this info is just dated or no longer accurate? Checked here most recently How to uninstall MSI using its Product Code in c#
Process process = new Process();
process.StartInfo.FileName = "MsiExec.exe";
process.StartInfo.Arguments = " /x " + productCode + " /Qn";
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.UseShellExecute = false;
process.Start();
string output = process.StandardOutput.ReadToEnd();
string err = process.StandardError.ReadToEnd();
Debug.WriteLine(output);
Debug.WriteLine(err);
process.WaitForExit();
return (process.ExitCode == 0) ? true : false; //exit code 1603, popup appears from Start()