I´m trying to get the R install path over C# but unfortunatly the Registry.LocalMachine.OpenSubKey(keyName)
method returns null.
This is my code:
var keyName = @"SOFTWARE\R-core\R";
using (var key = Registry.LocalMachine.OpenSubKey(keyName))
{
if (key != null)
{
var value = key.GetValue("InstallPath", 0);
Console.WriteLine(value);
}
else
{
Console.WriteLine("No key found!");
}
}
I manually checked if the key exists and it does.