none
How to check for softwares which are installed in PC while installing my C#.NET project? RRS feed

  • Question

  • Actually when a user is installing my software (C#.NET) then I want to check for Google Chrome is installed or not on that PC. According to that, I wanna show an error message if that Chrome is not installed.
    Wednesday, April 18, 2018 9:26 AM

Answers

  • Hello RavindraNathKashyap,

    Maybe you could try to check registry info.

        using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall", false))
                {
                    if (key != null)
                    {
                        foreach (string keyName in key.GetSubKeyNames())
                        {
                            using (RegistryKey key2 = key.OpenSubKey(keyName, false))
                            {
                                if (key2 != null)
                                {
                                    string softwareName = key2.GetValue("DisplayName", "").ToString();
                                    string installLocation = key2.GetValue("InstallLocation", "").ToString();
                                    if (!string.IsNullOrEmpty(installLocation)&& softwareName== "Google Chrome")
                                    {
                                        Console.WriteLine(softwareName+"--------------->");
                                        Console.WriteLine(installLocation);
                                    }
                                }
                            }
                        }
                    }
                }
              

    Best Regards,

    Neil Hu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, April 19, 2018 9:48 AM
    Moderator

All replies

  • How about this?
    Make a small program which tries to run "chrome.exe" and it is executed successfully, Google Chrome is installed.
    And include this program in your installer, or run it in your application at it starts only once.

    Ashidacchi -- http://hokusosha.com/

    Wednesday, April 18, 2018 9:40 AM
  • It can be done with the Shell, by reading keys like PKEY_ItemNameDisplay, PKEY_Software_InstallLocation

    (I had posted a sample in this thread)

    Wednesday, April 18, 2018 9:50 AM
  • Hello RavindraNathKashyap,

    Maybe you could try to check registry info.

        using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall", false))
                {
                    if (key != null)
                    {
                        foreach (string keyName in key.GetSubKeyNames())
                        {
                            using (RegistryKey key2 = key.OpenSubKey(keyName, false))
                            {
                                if (key2 != null)
                                {
                                    string softwareName = key2.GetValue("DisplayName", "").ToString();
                                    string installLocation = key2.GetValue("InstallLocation", "").ToString();
                                    if (!string.IsNullOrEmpty(installLocation)&& softwareName== "Google Chrome")
                                    {
                                        Console.WriteLine(softwareName+"--------------->");
                                        Console.WriteLine(installLocation);
                                    }
                                }
                            }
                        }
                    }
                }
              

    Best Regards,

    Neil Hu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, April 19, 2018 9:48 AM
    Moderator