"Cannot be ignored" assembly version error when calling OpenDocumentFile from within a running addin

"Cannot be ignored" assembly version error when calling OpenDocumentFile from within a running addin

rpetersS3SSH
Observer Observer
123 Views
1 Reply
Message 1 of 2

"Cannot be ignored" assembly version error when calling OpenDocumentFile from within a running addin

rpetersS3SSH
Observer
Observer

I have a Revit 2024 addin (IExternalApplication) that opens a second .rvt file in the background using OpenDocumentFile(ModelPath, OpenOptions) from within an IExternalCommand. The addin loads fine on Revit startup and the ribbon appears correctly. However, the moment OpenDocumentFile is called, Revit throws the following error:

Error - cannot be ignored Could not load file or assembly 'xyz, Version=1.0.3.0, Culture=neutral' or one of its dependencies. The system cannot find the file specified.

My assembly version is 1.0.0.0. There is no 1.0.3.0 anywhere on the machine — not in the GAC, not in Program Files, not in any known location. The .addin manifest in ProgramData points directly to my build output folder.

The error only occurs when OpenDocumentFile is called — not on initial Revit startup. It does not occur if I open the second document manually through the Revit UI.

Questions:

  1. Does OpenDocumentFile trigger addin re-initialization or assembly resolution against the new document context?
  2. Is there a known issue with addin assembly resolution when opening background documents from within a running addin?
  3. Is there a recommended pattern for opening a second document in the background from an IExternalCommand that avoids this?

Any guidance appreciated. 

 
 
0 Likes
124 Views
1 Reply
Reply (1)
Message 2 of 2

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @rpetersS3SSH ,

OpenDocumentFile itself does not reload the add-in or resolve assemblies in a separate document context. It opens the model into memory and raises normal document-open events. Therefore, the assembly load failure is most likely caused by code that is first executed during document open, such as a DocumentOpened handler, updater, event subscription, or dependency loaded lazily. The 1.0.3.0 version must exist as an assembly reference somewhere in the loaded dependency graph, even if no physical DLL with that version exists on disk.

Use Fusion Log Viewer, Process Monitor, ILSpy/dotPeek, or AssemblyResolve logging to identify which assembly is requesting xyz, Version=1.0.3.0.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes