1

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()
fr332lanc3
  • 101
  • 1
  • 10
  • Tried running with original installer and it will work specifying the msi file, but not using the /q option only without and interactive. So why won't it work with /q and why does the product code not work only the msi installer file? – fr332lanc3 Aug 30 '20 at 17:58
  • [Check section 6 here](https://stackoverflow.com/questions/450027/uninstalling-an-msi-file-from-the-command-line-without-using-msiexec/1055933#1055933). Normally you would author the Upgrade table to take care of the uninstall of older versions. – Stein Åsmul Aug 30 '20 at 22:22
  • [Please check this answer on major upgrades](https://stackoverflow.com/a/63529382/129130) (first I could find right now). [Check Microsoft Docs on major upgrades](https://docs.microsoft.com/en-us/windows/win32/msi/major-upgrades) to. – Stein Åsmul Aug 30 '20 at 22:29
  • [Updating Upgrade Table for an Upgrade](https://docs.microsoft.com/en-us/windows/win32/msi/updating-upgrade-table-for-an-upgrade). And a couple more links from past answers of mine: **`1:`** [The first couple of sections here](https://stackoverflow.com/a/51090120/129130), **`2:`** [Common major upgrade problems](https://stackoverflow.com/a/56991527/129130). – Stein Åsmul Aug 30 '20 at 22:38

0 Answers0