Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get GUID from an installed Application c#

Tags:

c#

guid

winforms

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?

like image 394
Diego Avatar asked May 18 '26 22:05

Diego


1 Answers

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.

like image 86
aolszowka Avatar answered May 24 '26 08:05

aolszowka