Revit Add-in runs in debug but not standalone.

Revit Add-in runs in debug but not standalone.

konstantin.udilovich
Explorer Explorer
508 Views
2 Replies
Message 1 of 3

Revit Add-in runs in debug but not standalone.

konstantin.udilovich
Explorer
Explorer

Hi,

I am observing a strange behavior. My IExternalApplication loads correctly and configures the buttons on the ribbon when I run it in Debug mode, by starting Revit as an external program from Visual Studio. At the compile time, the files are copied automatically into the Addin folder. When I close the Visual Studio and start Revit from a shortcut the app crashes when it tries to add a button to a ribbon. The contents of the Addin folder is the same.  I have checked that both VS and the desktop icon point to the same Revit.exe. What could be the difference in running an app in debug mode versus standalone Revit?

Additional information: I do use Managed Compatibility Mode in Visual Studio debug settings.

0 Likes
Accepted solutions (1)
509 Views
2 Replies
Replies (2)
Message 2 of 3

jeremytammik
Autodesk
Autodesk

Is 'Copy Local' set to false on the Revit API assemblies?

 

https://thebuildingcoder.typepad.com/blog/2011/08/set-copy-local-to-false.html

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 3

konstantin.udilovich
Explorer
Explorer
Accepted solution

Thanks for your response Jeremy. Yes, CopyLocal was set to false. Looks like I figured this one out. The problem was that for the AssemblyName parameter I used just the file name. Revit wanted to have a full path. This did the trick:

 

var fileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"Autodesk\Revit\Addins\2018\MyAddins.dll");
PushButtonData button1 = new PushButtonData("MyButton", "Export model data",fileName, "MyExportCommand");

 

I am still puzzled why it was working in Debug mode, but I need a full path when Visual Studio is not present ....

Thanks again.

0 Likes