Jinu
Jinu

Reputation: 78

Finding Edge Version for Webview2 WPF control in code

I am trying to find Microsoft Edge version using the bellow C# code.

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"))
        {
            Match rxEdgeVersion = null;
            rxEdgeVersion = Regex.Match(subkey, @"(Microsoft.MicrosoftEdge_)(?<version>\d+\.\d+\.\d+\.\d+)(_neutral__8wekyb3d8bbwe)");
                       
            if (rxEdgeVersion.Success)
                return EdgeVersion = rxEdgeVersion.Groups["version"].Value;
            }
        }
    }
}

This function returns the version 44.18362.449.0. But when i directly checking in Edge browser =>Settings=>help (edge://settings/help) version is Version 84.0.522.40

These two version patterns are not matching, also i have no parallel installation of different edge versions.

Please help me to relate both versions which are from browser UI and by C#.

Upvotes: 3

Views: 2063

Answers (2)

Deepak-MSFT
Deepak-MSFT

Reputation: 11335

If you want to check the MS Edge Chromium browser version using C# code then I suggest try to check it on location below in the registry.

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{2CD8A007-E189-409D-A2C8-9AF4EF3C72AA}

If you check the value of the PV key then you can notice that it is showing the version of the Edge Chromium browser.

enter image description here

If you have other versions like Canary, beta, dev or stable then you can try to check the other folders in the Clients folder may help to get the version of the installed Edge Chromium browser.

Upvotes: 2

Falco Alexander
Falco Alexander

Reputation: 3332

have a look at C:\Program Files (x86)\Microsoft\Edge\Application there you'll likely find the new Chromium Edge with the correct version numbers as embedded in the file msedge.exe as well as in the folder name.

but why don't you check the browsers userAgent string? they have the version number included!

Upvotes: 1

Related Questions