7

I'm writing a windows form application (c#) and I need to detect whether the user have "Microsoft-Edge" installed in his/her machine or not.

I'm currently using this registry location:

[HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Packages\Microsoft.MicrosoftEdge_20.10240.16384.0_neutral__8wekyb3d8bbwe]
"Path"="C:\\Windows\\SystemApps\\Microsoft.MicrosoftEdge_8wekyb3d8bbwe"

With a regex after the "Microsoft.MicrosoftEdge". If the "path" exist then I know edge is installed.

Is there a better way to detect edge? would it be better if I detect that I'm running on Windows 10 and by default Win10 come with edge? What is the best way for that?

4
  • 2
    Yes, Windows 10 comes with Microsoft Edge and I don't think you can uninstall Edge from it, and you definitely can't install it in previous versions of Windows Commented Nov 8, 2015 at 14:24
  • 2
    I was looking for a way to doing exactly what you wanted to do. And I found that your method is for me by far the best. If future versions of Windows drop Edge, your code will still work. Presuming of the presence of a feature based on the version of the OS is really not better than testing the existence of the feature itself. I just hope this key is the best one ;) Cheers. Commented Feb 16, 2016 at 11:30
  • I'm happy to hear that. Please update if you find a better one :) Commented Feb 17, 2016 at 12:56
  • 1
    You actually can uninstall Microsoft Edge. It's a package app like everything else. http://news.softpedia.com/news/how-to-remove-microsoft-edge-from-windows-10-491534.shtml Commented May 11, 2016 at 0:40

4 Answers 4

4

In case you want to have a small program getting that version number:

static void Main(string[] args)
    {
        string EdgeVersion = string.Empty;
        //open the registry and parse through the keys until you find Microsoft.MicrosoftEdge
        RegistryKey reg = Registry.ClassesRoot.OpenSubKey(@"Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Packages");
        if (reg != null)
        {
            foreach (string subkey in reg.GetSubKeyNames())
            {
                if (subkey.StartsWith("Microsoft.MicrosoftEdge"))
                {
                    //RegEx: (Microsoft.MicrosoftEdge_)(\d +\.\d +\.\d +\.\d +)(_neutral__8wekyb3d8bbwe])
                    Match rxEdgeVersion = null;
                    rxEdgeVersion = Regex.Match(subkey, @"(Microsoft.MicrosoftEdge_)(?<version>\d+\.\d+\.\d+\.\d+)(_neutral__8wekyb3d8bbwe)");
                    //just after that value, you need to use RegEx to find the version number of the value in the registry
                    if ( rxEdgeVersion.Success )
                        EdgeVersion = rxEdgeVersion.Groups["version"].Value;
                }
            }
        }

        Console.WriteLine("Edge Version(empty means not found): {0}", EdgeVersion);
        Console.ReadLine();
    }

Thank you for the registry link for finding the version number.

Sign up to request clarification or add additional context in comments.

2 Comments

A direct paste of this code worked fine for me on getting the edge version. Microsoft Edge version=41.16299.492.0
I just tested this on Windows 10. It did return Edge Version(empty means not found): 44.19041.423.0. But, when I start Microsoft Edge (Chromium) and check the About window it says: Version 86.0.622.56 (Official build) (64-bit). So I am confused.
2

If you're on the desktop or mobile version of Windows 10 then Edge is pre-installed and can't be uninstalled.

To detect if running on Windows 10 use the System.Environment.OSVersion property or the Version Helper functions. (See also https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx)

If you want to detect the default browser you should see How to determine the Windows default browser (at the top of the start menu)

1 Comment

Here is some interesting reference to detect Windows version.
1

In reference to other answers: my installation of Windows 10 does not have this key: Microsoft.MicrosoftEdge_20.10240.16384.0_neutral__8wekyb3d8bbwe

In:

[HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Packages\]

Instead, it has the following keys:

Microsoft.MicrosoftEdge_38.14393.0.0_neutral__8wekyb3d8bbwe
Microsoft.MicrosoftEdge_40.15063.674.0_neutral__8wekyb3d8bbwe

The following code could be used to detect if Edge is installed:

class Program
{
    static void Main(string[] args)
    {
        var edgeFound = false;
        using (var key = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(@"Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Packages\"))
        {
            if (key != null)
            {
                foreach (var subkey in key.GetSubKeyNames())
                {
                    if (subkey.StartsWith("Microsoft.MicrosoftEdge_"))
                    {
                        edgeFound = true;
                        break;
                    }
                }
            }
        }
        Console.Write(edgeFound);
        Console.ReadLine();
    }
}

Comments

0

Relevant to 15.11.2016:

The only way that I found working is to use this registry location:

[HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Packages\Microsoft.MicrosoftEdge_20.10240.16384.0_neutral__8wekyb3d8bbwe]
"Path"="C:\\Windows\\SystemApps\\Microsoft.MicrosoftEdge_8wekyb3d8bbwe"

With a regex after the "Microsoft.MicrosoftEdge".

If the "path" exist then I know edge is installed.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.