regedit注册表

using Microsoft.Win32;

StartMenu、控制面板删除安装信息

// HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Uninstall
var subKey = @"SOFTWAREMicrosoftWindowsCurrentVersionUninstall";
var ndpKey = Registry.LocalMachine.OpenSubKey(subKey);
if (ndpKey != null)
{
    var rslt = ndpKey.OpenSubKey(oldProductCode, true);
    if (rslt != null)
    {
        foreach (var item in rslt.GetValueNames())
        {
            rslt.DeleteValue(item, true);
        }
        rslt.Close();
    }
}                    
// HKEY_CLASSES_ROOT/Installer/Products
subKey = @"InstallerProducts";
ndpKey = Registry.ClassesRoot.OpenSubKey(subKey);
if (ndpKey != null)
{
    var rslt = ndpKey.OpenSubKey(oldProductCode);
    if (rslt != null)
    {
        foreach (var item in rslt.GetValueNames())
        {
            rslt.DeleteValue(item, true);
        }
        rslt.Close();
    }
}                
// HKEY_CURRENT_USER/Software/Microsoft/Installer/Products
subKey = @"SoftwareMicrosoftInstallerProducts";
ndpKey = Registry.CurrentUser.OpenSubKey(subKey);
if (ndpKey != null)
{
    var rslt = ndpKey.OpenSubKey(oldProductCode);
    if (rslt != null)
    {
        foreach (var item in rslt.GetValueNames())
        {
            rslt.DeleteValue(item, true);
        }
        rslt.Close();
    }
}  
原文地址:https://www.cnblogs.com/wesson2019-blog/p/14158323.html