dllautodesk-forgerevit-apiautodesk-designautomation

Resolve Assemblies in Design Automation for Revit


I'm using Design Automation to modify family parameter values based on data in a CSV file. The CSV library I am using depends on Microsoft.Bcl.AsyncInterfaces v1.0.0.0+ and the JSON library I'm using depends on Microsoft.Bcl.AsyncInterfaces v7.0.0.0. I can only include one or the other in my AppBundle (due to duplicate naming in the same directory), but either way I get an Exception from the DA4R runtime based on whichever is missing:

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.

My local version of this add-in uses an app.config file with a binding redirect to resolve this but my DA4R version isn't working because it doesn't include that file.

Based on this example I think a custom assembly resolve function would work but I don't know how to access the location of the assembly files.

The local runtime directory only includes my working files and not my AppBundle files. I can see those files are located at T:\Aces\Applications\ffc6436bec04d21d55ea37de192e1fe6.<APPNAME>.<ACTIVITYNAME>[##].package but for obvious reasons do not want to hard-code my current version number into my source code.

Am I on the right track or is there an easier way?


Solution

  • Yes, you can access AppBundle files during the running of WorkItem. Please refer to: https://forge.autodesk.com/blog/handle-command-line-arguments and https://forge.autodesk.com/blog/store-template-documents-appbundle