I am doing a winform application that need to uninstall another Winform application that is installed by installshield. I have searched the correct way to unistall it is
Process.Start("msiexec /x {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"); where xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx represents GUID of that application that you want to uninstall.
But I do not how can I find the GUID from an application called text.exe
I have found
var assembly = typeof(Program).Assembly; var attribute = (GuidAttribute)assembly.GetCustomAttributes(typeof(GuidAttribute), true)[0]; var id = attribute.Value;
but this retrieves the GUID from the current Application.
Any ideas?
That GUID is the GUID associated with the installer (more accurately known as a Package Code), you'll be able to pull these from HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, I am not familiar with the ability to pull this directly from the application.
*Edit Alternatively if you have access to the WiX script (should you be using WiX to generate the MSI) it should be the Id attribute of the Product Element. You may also be able to use a tool such as Orca to check this property of an MSI that has already been created.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With