1567/2078
Handling Third Party Library DLL Conflicts
Originally Published inA recurring question just came up again, on handling conflicts between DLLs loaded by Revit add-ins.
For instance, this can be caused by a scenario in which add-ins A and B both make use of library DLL C, but specify different versions. A soon as the first add-in has loaded its version of C, the second add-in is prevented from loading the version it requires and cannot run.
I have no official solution to suggest for this, just these discussion threads and articles suggesting various workarounds:
- Proper way to handle App.config bindingRedirects in Revit add-in ↗
- Loading different versions of same third party library ↗
- Loading multiple versions of the same DLL used in Revit plug-ins ↗
- The Managed Extensibility Framework MEF ↗ offers an option but requires a lot of changes.
- A Plug-In System Using Reflection, AppDomain and ISponsor ↗
- You can also use ILMerge ↗ to merge all of your DLLs into one single .NET assembly, cf. the CodeProject article on Merging .NET assemblies using ILMerge ↗
Addendum – Updated ILMerge Link
As noted by Micah Gray in his comment below ↗:
The ILMerge link above no longer works. It appears to have moved over to the GitHub ILMerge repository ↗.