A minimal Autodesk Inventor add-in sample that demonstrates safe dependency isolation. Inventor ships with specific assembly versions. Referencing newer (or different) versions in an add-in often causes binding conflicts. This sample allows the use of NuGet package/assembly versions that differ from the ones bundled with Inventor by isolating the add-in’s dependencies in a custom load context.
- Clone this project or download it. It's recommended to install GitHub Desktop. To clone it via command line, use the following:
git clone https://github.com/tylerwarner33/autodesk-inventor-assembly-load-context.git
- Choose a configuration:
Debug-2026,Debug-2025,Debug-2024,Debug-2023(or the correspondingRelease-*) to work with that Inventor version. - Build the solution. The post-build step creates a bundle and copies it to (replace
<version>and paste in file explorer):%AppData%\Autodesk\Inventor <version>\Addins\IsolatedInventorAddin.bundle\Contents\
- Run the solution (Inventor will launch automatically using the selected version, as configured in the project file).
- Use the
Serilog Versionbutton to display the version/context of the loaded Serilog assembly.
AddinServer.cs- The main entry point for the add-in using the
OnActivate()andOnDeactivate()methods. Custom add-in logic added here. - Inherits
Isolation/IsolatedApplicationAddInServer.cswhich implementsInventor.ApplicationAddInServer.
- The main entry point for the add-in using the
- .NET 8 / Inventor 2025+:
Isolation/AddinLoadContext.csdefines a dedicatedAssemblyLoadContextand usesAssemblyDependencyResolverso the add-in resolves managed and native dependencies from its own output folder first.
- .NET Framework 4.8 / Inventor 2023–2024:
- The add-in runs in the default
AppDomain. The sample still reports assembly identity to compare behavior across targets.
- The add-in runs in the default
- The Interop assembly (
Autodesk.Inventor.Interop) is referenced with<Private>False</Private>so it’s always loaded from Inventor, while the NuGet dependencies (ex.Serilog) are copied beside the add-in and loaded in isolation. - The
Serilog Versionbutton (SerilogPackageVersionButton) shows the loaded Serilog version and the load context/app domain to verify isolation. - The project uses MSBuild logic to pick the Inventor version and target framework based on the build configuration.
- TylerWarner.dev Blog Post: Isolate Inventor Add-In
- Microsoft Learn: System.Runtime.Loader.AssemblyLoadContext
- Microsoft GitHub: AssemblyLoadContext
This sample is licensed under the terms of the MIT License. Please see the LICENSE file for more details.


