Do I need to include RevitAPI.dll and RevitAPIUI.dll in my release package?

Do I need to include RevitAPI.dll and RevitAPIUI.dll in my release package?

adam_konca
Enthusiast Enthusiast
2,066 Views
11 Replies
Message 1 of 12

Do I need to include RevitAPI.dll and RevitAPIUI.dll in my release package?

adam_konca
Enthusiast
Enthusiast

Hi,

This is a fairly simple question that came to mind when I started researching Design Automation (APS/Forge). One of the DA tutorials says that Revit API dlls are not required in app bundle and that is correct. I managed to upload the app bundle with just my dll + addin file and was able to run a successful work.

Before we switch completely to Forge, we still have our regular addin and as of now, we are including Revit API files into our release package (that is installed on client computers with Revit). Seeing the Forge case, I started wondering, is this required for regular addins?

Thanks a lot for you time.

0 Likes
Accepted solutions (1)
2,067 Views
11 Replies
Replies (11)
Message 2 of 12

moturi.magati.george
Autodesk
Autodesk

Hi @adam_konca,

 

Forge is a cloud-based service. This means that instead of installing the software on your machine, the same is done on Autodesk servers and you are able to utilize the resources online.

 

This said, you don't need to include to include RevitAPI.dll and RevitAPIUI.dll when building a forge application. If some services might need it, I might not be aware of the same.

 

You can read more here: https://aps.autodesk.com/blog/what-forge

 

You can also view examples and walkthroughs here: https://github.com/orgs/Autodesk-Forge/repositories?type=all

 

 

 

  Moturi George,     Developer Advocacy and Support,  ADN Open
Message 3 of 12

jeremy_tammik
Alumni
Alumni
Accepted solution

Yes, and to address the desktop part of your question (well, the only part, actually):

  

Nope, absolutely no need to include the Revit API assemblies with your desktop add-in distribution, and actually a big non-no to do so. They are part of the Revit installation and live in the same folder as Revit.exe itself. In your development environment, you should set the 'Copy Local' property on all Revit API assemblies to 'false' to ensure that they are not copied into your distribution package. Your add-in should (and must) use the Revit API assemblies provided (and already loaded) by Revit:

  

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 4 of 12

ricaun
Advisor
Advisor
It's a good practice to not include the RevitAPI.dll or other dll file included in Revit with your release.

Most of the time Revit gonna ignore the dll that is already loaded.

And the Revit in Forge/APS works in the same way, is basically the same engine without the UI.

In the end, is better to not include it, makes your package smaller size. (RevitAPI.dll around ±28kb)
Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

0 Likes
Message 5 of 12

adam_konca
Enthusiast
Enthusiast

@moturi.magati.georgeYes, I already knew I don't need them in Forge 🙂

@jeremy_tammikThank you very much for the info. This is exactly what I wanted to hear. Awesome news.

@ricaunActually, package size is one of the reasons I asked this question, because we support multiple Revit versions, so deleting multiple revit api files is going to reduce size quite a lot 🙂

0 Likes
Message 6 of 12

adam_konca
Enthusiast
Enthusiast

@jeremy_tammikOne more question if I may. What about other libraries like Newtonsoft.Json.dll? I see that it also comes with Revit, so can I set "Copy Local" to false on it as well? What happens when I use newer version of this library than the one provided with Revit? Which one would be loaded?

Message 7 of 12

ricaun
Advisor
Advisor

I never copy the Newtonsoft.Json.dll and always use version 9.0.1. 

 

If your application ask for a bigger version than that Revit contain, probably gonna load two version of the Newtonsoft.Json in the AppDomain and stages things could happen.

 

Like this: https://forums.autodesk.com/t5/revit-api-forum/bim-360-links-not-found-fix/td-p/11463147

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

Message 8 of 12

adam_konca
Enthusiast
Enthusiast
Does it mean that every time I am adding a library to my addin, I need to check if it is shipped with Revit first? And if it is, just add the same version to my addin with "Copy Local" set to false?
However, if it is not shipped with Revit then I can freely add my version with "Copy Local" true.
Do I understand it correctly?
Message 9 of 12

ricaun
Advisor
Advisor

@adam_konca wrote:
Does it mean that every time I am adding a library to my addin, I need to check if it is shipped with Revit first? And if it is, just add the same version to my addin with "Copy Local" set to false?
However, if it is not shipped with Revit then I can freely add my version with "Copy Local" true.
Do I understand it correctly?

Basically yes, and if you copy the reference to your addin folder, most of the time Revit gonna ignore it and use the version that is already loaded in the AppDomain or load a version shipped with Revit.

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

Message 10 of 12

adam_konca
Enthusiast
Enthusiast
Good to know. Thanks!
Message 11 of 12

jeremy_tammik
Alumni
Alumni

I totally agree with Luiz. Only one version can be loaded, because there is only one AppDomain for the Revit API. Revit has already loaded its version, so your attempt to load a different one will fail. So, you cannot use a newer version than the one used by Revit. In some (rare?) cases, Revit includes an add-in or other piece of functionality that doies not load all its dependencies up front; in that case, if you load your own ("wrong") version first, you might even end up breaking some of the built-in Revit functionality.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 12 of 12

adam_konca
Enthusiast
Enthusiast
Makes perfect sense. Once again, appreciate the explanations. Thanks.
0 Likes