To uninstall a Windows application using C#, a registry key containing the uninstall information needs to be located and the uninstall command needs to be executed in a new process.
First, locate the registry key corresponding to the application's uninstall information.
main.cs766 chars21 lines
Once the uninstall command is obtained, execute it in a new Process.
main.cs258 chars8 lines
In the uninstallCommand
, replace {PRODUCT_CODE}
with the actual product code obtained from the registry key.
Note: The above code snippets only uninstall applications installed using Windows Installer. For other applications, the uninstallation command may vary.
gistlibby LogSnag