1

I have a C# application installed with InstallShield Evaluation Version 2013, and I want to uninstall it from another C# application


I run the process to uninstall it like this:

p.StartInfo.FileName = "msiexec.exe";

            p.StartInfo.UseShellExecute = false;
            p.StartInfo.Arguments = "/x {XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}";
             p.Start();

And the result is an error message:

"The action is only valid for products that are currently installed"

The product is installed with InstallShield Trial Version. If I installed the product with Limited InstallShield, the uninstall process executes perfectly.


Is this problem because it is an evaluation version, or I am missing something else?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Diego
  • 2,238
  • 4
  • 31
  • 68

2 Answers2

0

If the GUID of the product has changed in between versions of InstallShield (which is very likely if you let it create a default GUID) then it is probably looking for the old GUID in the registry to uninstall. You may need to clean up the old registry entry manually. There is information about doing that here.

Jeff
  • 739
  • 12
  • 31
0

Most likely you got the wrong GUID as Jeff points out. You can find several ways to find the right one in this answer on how to uninstall an MSI: MSI uninstall details. Or better yet, go straight to this answer on how to find the product GUID for your setup: How can I find the product GUID of an installed MSI setup?

I would also try to build the command line in code, serialize it to a string and manually try it using msiexec.exe in a command window to verify its validity. It is a complex, error prone command line interface. Your error message indicates a wrong GUID though.

Finally: Instead of invoking msiexec.exe as a command line, you can use DFT - Deployment Tools Foundation which is a .NET wrapper for the Win32 Windows Installer API. No command line to build or error codes to check, just easy to use .NET classes to deal with all aspects of MSI. This will allow you to run uninstall via code that supports even exception handling properly. DTF is distributed as part of Wix as explained here. See this post on serverfault.com (system administrator site) for a better rundown of the different approaches. And see a sample C# code snippet for its use in MSI uninstall details.

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164