Revit References in Visual Studio

Revit References in Visual Studio

Jaime_Alonso
Enthusiast Enthusiast
1,844 Views
6 Replies
Message 1 of 7

Revit References in Visual Studio

Jaime_Alonso
Enthusiast
Enthusiast

Hi,

 

I am trying to add the assemblies to my Visual Studio project for the following statements;

using Revit.Elements;
using BuiltinNodeCategories = Revit.Elements.BuiltinNodeCategories;
using Category = Revit.Elements.Category;

However, I could not find which assembly is. I guessed it could be Revit.dll but when I try to load Visual Studio shows:

A reference to "..." could not be added. Please make sure that the file is accessible.

Is this related to API retrictions or these namespaces could be found in other assemblies?

Thanks

 

0 Likes
Accepted solutions (1)
1,845 Views
6 Replies
Replies (6)
Message 2 of 7

Maltezc
Advocate
Advocate
What version of revit?
0 Likes
Message 3 of 7

Jaime_Alonso
Enthusiast
Enthusiast

Revit 2022, but I have tried also with 2021.

0 Likes
Message 4 of 7

RPTHOMAS108
Mentor
Mentor
Accepted solution

Those are namespaces used with DynamoRevit, not part of RevitAPI.

 

Revit.Elements
C:\Program Files\Autodesk\Revit 2022\AddIns\DynamoForRevit\Revit\RevitNodes.dll.

0 Likes
Message 5 of 7

Jaime_Alonso
Enthusiast
Enthusiast

@RPTHOMAS108  Thank you very much!

0 Likes
Message 6 of 7

RPTHOMAS108
Mentor
Mentor

If you are programming with Dynamo i.e. zero touch nodes etc. I suggest it is easier to install from NuGet because there are many other references required for that.

Message 7 of 7

TheLaymansShaman
Explorer
Explorer

Just posting this answer incase it helps anyone as this had me baffled for a few hours. I had a working addin for Revit 2018, 19 & 20 which refused to build in Visual Studio when I switched my configuration to 2021 or later. It wasn't finding the RevitUI.dll and RevitAPIUI.dlls and adding them back in manually always created this "..." could not be added. Please make sure that the file is accessible" error. The solution turned out to be switching the version of .net framework to 4.8 from 4.7 for those later versions. I did this by adding conditions to my debug configurations for the later Revit versions in the .csproj file. Solutions then built with no errors. Can provide  further info on how to do this if needs be should it turn out to fix someone else's issue also. 

0 Likes