Update Revit Plugin dll

Update Revit Plugin dll

m.walterN99B3
Contributor Contributor
551 Views
3 Replies
Message 1 of 4

Update Revit Plugin dll

m.walterN99B3
Contributor
Contributor

Actually my Plugin is located under c:\ProgramData\Autodesk\Revit\Addins\2024\MyPlugin\MyPlugin.dll

 

I like to press a button in the Plugin and start an update process to replace the MyPlugin.dll and copy some files to the folder c:\ProgramData\Autodesk\Revit\Addins\2024\MyPlugin\

Is this possible?

Does the Plugin have to be closed or maybe Revit?

0 Likes
552 Views
3 Replies
Replies (3)
Message 2 of 4

ricaun
Advisor
Advisor

If the file 'MyPlugin.dll' has been used by Revit you cannot replace the file until the Revit process finishes (close Revit).

 

That's how a Windows application works, if a DLL is been used by some process, is not possible to replace/delete the DLL until you finish the application that is using the file.

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

0 Likes
Message 3 of 4

m.walterN99B3
Contributor
Contributor

But maybe I could create a MyPluginLibrary.dll too, that is loadad by the MyPlugin.dll at runtime like this:
Assembly assembly = Assembly.LoadFrom("MyPluginLibrary.dll");
and contains the main code.

 

So I could Unload, Update and Load the MyPluginLibrary.dll when I need it.
Could this work?
But maybe I do not have the rights to copy files to the AddIns folder? 

0 Likes
Message 4 of 4

ricaun
Advisor
Advisor

If you load 'MyPluginLibrary.dll' the file gonna be used by Revit the same way as the 'MyPlugin.dll'.

 

Unload is not possible in the Net Framework, if the file is loaded the file is blocked until you close Revit.

 

The location/directory gonna depends on what your user has rights inside the folder.

You could use the folder %appdata%\Autodesk\Revit\Addins\ that is only available for the current user, and the user can do anything there.

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

0 Likes