ASP.NET ではなく、通常の C# を使用しています。Chrome と Firefox のバージョンを入手できるかどうか疑問に思っていました。IEの場合、レジストリからバージョンを取得できることを知っています。私が知る限り、Chrome と Firefox はその情報をレジストリに保存しません。
前もって感謝します。
ASP.NET ではなく、通常の C# を使用しています。Chrome と Firefox のバージョンを入手できるかどうか疑問に思っていました。IEの場合、レジストリからバージョンを取得できることを知っています。私が知る限り、Chrome と Firefox はその情報をレジストリに保存しません。
前もって感謝します。
アプリケーションの完全なパスがわかっている場合は、System.Diagnostics.FileVersionInfoクラスを使用してバージョン番号を取得できます。
以下は、レジストリから Chrome と Firefox のインストール パスを読み取り、それらのバージョン番号を出力する単純なコンソール アプリケーションです。
using System;
using System.Diagnostics;
using Microsoft.Win32;
class Program
{
static void Main(string[] args)
{
object path;
path = Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe", "", null);
if (path != null)
Console.WriteLine("Chrome: " + FileVersionInfo.GetVersionInfo(path.ToString()).FileVersion);
path = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe", "", null);
if (path != null)
Console.WriteLine("Firefox: " + FileVersionInfo.GetVersionInfo(path.ToString()).FileVersion);
}
}
出力例:
Chrome: 24.0.1312.52
Firefox: 16.0.2