Mandi Bishop
Mandi Bishop

Reputation: 27

Autodesk Revit 2021.1 Hot fix change to Autodesk.RevitAddIns.InstallLocation

After upgrading to Revit 2021.1, the API call to Autodesk.RevitAddIns.InstallLocation (in RevitAddInUtility.dll) seems to no longer return the full Revit path but rather the sub path (eg, Revit 2021 instead of c:\Program Files\Autodesk\Revit 2021).

This is causing problems when trying to launch Revit programmatically when Revit is installed on d:\ or another location.

Upvotes: 0

Views: 348

Answers (1)

Coolicky
Coolicky

Reputation: 21

What can be done is look for a registry key describing location of the Revit installation folder. Something like this for Revit 2020.

Registry Location for 2020

        string regAdress = @"SOFTWARE\Autodesk\Revit\2020";
        var key = Registry.LocalMachine.OpenSubKey(regAdress);

        foreach (var item in key.GetSubKeyNames())
        {
            if (item.ToLower().StartsWith("revit"))
            {
                var revitKey = Registry.LocalMachine.OpenSubKey($"{regAdress}\\{item}");
                reviInstallLocation = revitKey.GetValue("InstallationLocation").ToString();
            }
        }

Not sure how your code works specifically but this should be able to find You the necessary installation path.

Upvotes: 1

Related Questions