在 Windows 10 上安装 Microsoft Edge Chromium 版本

Getting the Microsoft Edge Chromium version installed on Windows 10

根据我发现的其他信息,我得出以下结论:

using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        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();
        }
    }
}

但是,它提供了旧版 Microsoft Edge 的版本号,而不是较新的 Microsoft Edge Chromium.

此代码需要进行哪些更改?

根据评论中的答案,我有一个有效的 C# 示例:

using Microsoft.Win32;
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string EdgeVersion = string.Empty;

            RegistryKey reg = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Edge\BLBeacon");
            if(reg != null)
            {
                EdgeVersion = reg.GetValue("version").ToString();
            }

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