need to check already application installed or not using custom installer class

后端 未结 1 633
野的像风
野的像风 2021-01-07 14:36

I\'ve to create one C# setup project application, at that time while installing i also include custom actions - install to filezilla server . Before install filezilla server

相关标签:
1条回答
  • 2021-01-07 15:31

    You could try using Microsoft.Win32 namespace for registry classes:

        string regKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
        using (Microsoft.Win32.RegistryKey key = Registry.LocalMachine.OpenSubKey(regKey))
        {
            if (key.GetSubKeyNames().Any(keyName => key.OpenSubKey(keyName).GetValue("DisplayName") == "My App's Display Name"))
                Console.WriteLine("Already installed...");
            else
                Console.WriteLine("Start installing...");
        }
    
    0 讨论(0)
提交回复
热议问题