How can I check what version/edition of Visual Studio is installed programmatically?

前端 未结 10 1129
萌比男神i
萌比男神i 2020-12-16 09:16

I could read registry HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0. However, it doesn\'t give me any information about the edition of it - Profes

10条回答
  •  我在风中等你
    2020-12-16 10:10

    if somebody needs C# example then:

    var registry = Registry.ClassesRoot;
    var subKeyNames = registry.GetSubKeyNames();
    var regex = new Regex(@"^VisualStudio\.edmx\.(\d+)\.(\d+)$");
    foreach (var subKeyName in subKeyNames)
    {
        var match = regex.Match(subKeyName);
        if (match.Success)
            Console.WriteLine("V" + match.Groups[1].Value + "." + match.Groups[2].Value);
    }
    

提交回复
热议问题