0

I would like to add the reference to "RevitAPI.dll" & "RevitAPIUI.dll" as a relative reference in Visual Studio 2022.

Whenever I add them by navigating to C:\Program Files\Autodesk\Revit 2021\RevitAPI.dll, Visual Studio adds it as a absolute path like this - ..\..\..\..\..\..\Program Files\Autodesk\Revit 2021\RevitAPI.dll

The problem here is that when we clone this across devices, this path may not be correct because the respective developer may clone it in their own desired location.

I've noticed in few OpenSource projects that the HintPath was like this: $(ProgramW6432)\Autodesk\Revit 2017\RevitAPI.dll. But when I open those projects in Visual Studio 2022, the reference is not working.

So what is the right way to add a reference to Revit API? Is it possible to add a Relative reference?

torek
  • 448,244
  • 59
  • 642
  • 775
Gangula
  • 5,193
  • 4
  • 30
  • 59
  • This seems to have nothing to do with Git, but see [Visual Studio: Relative Assembly References Paths](https://stackoverflow.com/q/1210754/1256452). Also, note that `../` is by definition relative; it sounds like you *don't* want a relative path, but rather a path with some kind of interpolation done. – torek Aug 02 '22 at 04:55
  • `../` is relative to where my folder is cloned. If I clone my repo in C drive and another developer clones it in D drive, then the relative reference won't work, because the path to `Program Files` is not in D drive. So being able to use `$(ProgramW6432)` will be helpful even if the clone is in D drive – Gangula Aug 02 '22 at 06:22

1 Answers1

1

The right way is not to rely on Revit being installed on a device at all. That will enable you to do CI/CD and builds on the server in the future.

You have two possibilities to achieve that:

I prefer the first option since there are not available official nugets from Autodesk .

NeVeS
  • 48
  • 1
  • 5