private static string GetInstallationRootPath(ClrBitness bitness) { using (var baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, bitness.ToRegistryView())) { using (var installRootKey = baseKey.OpenSubKey(NET_FRAMEWORK_REGISTRY_KEY_NAME) ?? throw new InvalidOperationException($"The key '{NET_FRAMEWORK_REGISTRY_KEY_NAME}' does not exist.")) { return(installRootKey.GetValue("InstallRoot") as string); } } }