How do I tell if .NET 3.5 SP1 is installed?

前端 未结 7 1014
失恋的感觉
失恋的感觉 2020-11-29 00:16

How can I find out if SP1 has been installed on a server which has .NET 3.5?

7条回答
  •  野性不改
    2020-11-29 01:20

    Assuming that the name is everywhere "Microsoft .NET Framework 3.5 SP1", you can use this:

    string uninstallKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
    using (RegistryKey rk = Registry.LocalMachine.OpenSubKey(uninstallKey))
    {
        return rk.GetSubKeyNames().Contains("Microsoft .NET Framework 3.5 SP1");
    }
    

提交回复
热议问题