Load spesific version of dynamo revit programatically

Im working on automating the process of running a dynamo script from a revit addin in C#

I have a working solution to run a Dynamo script from my addin when version 2 is loaded through the user interface.

i have been trying to reverse engineer the process of programatically load a spesific version of dynamo revit, but i cant get it to work.

All i want is to make sure dynamo for revit is initialized and all assemblies loaded just like the version selection popup does. The loading and initialization must happen without any user interaction.

I have tried to load all assemblies from “C:\Program Files\Dynamo\Dynamo Revit\2” and C:\Program Files\Dynamo\Dynamo Core\2 with no luck.
I get an exception message something like: RevitServicesUpdater is not initialized.

If i now try to start dynamo from Revit i can tell that the right version is not loaded because i get the
Dynamo version selection popup

If i start Revit and open dynamo and then select version 2.x.x my addin runs the Dynamo script just fine. To the best of my knowledge this is a assembly loading and initialization issue.

The working code to run a Dynamo script (after the correct version is loaded using the UI) looks like this https://forums.autodesk.com/t5/revit-api-forum/dynamo-script-in-revit-api/m-p/9087859/highlight/true#M41896

In advance, thank you.

I am not aware of a way to force a specific version to load. Forcing the ‘last executed’ version can be pulled from the Dynamo Player GitHub, but if hasn’t been done during the active session than Dynamo 1.x will usually be the default.

My recommended solution: uninstall all things Dynamo 1.x and move on in a 2.0 only environment. Starting in 2020 this is a non-issue as ‘there can be only one’ Dynamo from that point forward, and all Revit versions are compatible with 2.0+, and have been for over a year now. Eventually 1.x content is going to need to be updated, so why not take the bandaid off already?

1 Like

Thank you for your reply.
I will look into this when we(my company) decide to migrate to v2.0 of Dynamo