Decorative gear background

Inventor add-ins from scratch: the smallest thing that loads

December 2, 2026

•

By Bas Nederveen

•

6 min read

Autodesk Inventor
Addin Development
COM
.NET

An Inventor add-in needs three things on disk to load: a COM-visible .NET class, an XML manifest that points at it, and a folder under one of the two paths Inventor scans at startup. This post covers the smallest version of all three — about eighty lines of code in total. It's the first post in a series on the structure I use for Inventor add-ins, and exists so the later posts have a baseline to refer back to.

The csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net8.0-windows</TargetFramework>
    <Nullable>enable</Nullable>
    <UseWPF>true</UseWPF>
    <EnableComHosting>true</EnableComHosting>
  </PropertyGroup>

  <ItemGroup>
    <Reference Include="Autodesk.Inventor.Interop">
      <HintPath>C:\Program Files\Autodesk\Inventor 2026\Bin\Public Assemblies\Autodesk.Inventor.Interop.dll</HintPath>
      <Private>false</Private>
      <EmbedInteropTypes>false</EmbedInteropTypes>
    </Reference>
  </ItemGroup>

  <ItemGroup>
    <None Update="HelloAddin.Inventor.Addin">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
  </ItemGroup>

</Project>

<EnableComHosting>true</EnableComHosting> tells the SDK to emit a HelloAddin.comhost.dll next to the managed DLL. Inventor activates add-ins through COM, so comhost is what makes the class instantiable from outside the .NET runtime. It's the first thing to check if Inventor doesn't list the add-in.

The Autodesk.Inventor.Interop reference is marked Private=false so MSBuild compiles against the assembly without copying it into the build output. Inventor has its own copy of Autodesk.Inventor.Interop.dll loaded into the host process; shipping a second copy alongside the add-in produces type-identity mismatches, where the add-in's Inventor.Document type is treated as different from Inventor's Inventor.Document type, and casts across the boundary throw InvalidCastException. EmbedInteropTypes=false keeps the runtime binding behaviour; embedding interop types is a different mode that breaks ribbon callbacks and event subscriptions, so it's not what you want here.

HelloAddin.Inventor.Addin is the manifest, included as a <None> item with CopyToOutputDirectory="PreserveNewest" so a single build produces both the DLL and the manifest in the output folder.

The class

using System.Runtime.InteropServices;
using Inventor;

namespace HelloAddin;

[ComVisible(true)]
[Guid("8F3A2B6E-1C2D-4E5F-9A1B-2C3D4E5F6A7B")]
public class Plugin : ApplicationAddInServer
{
    private Application? app;
    private ButtonDefinition? helloButton;

    public void Activate(ApplicationAddInSite addInSiteObject, bool firstTime)
    {
        app = addInSiteObject.Application;

        helloButton = app.CommandManager.ControlDefinitions.AddButtonDefinition(
            DisplayName:    "Say Hello",
            InternalName:   "HelloAddin.SayHello",
            Classification: CommandTypesEnum.kShapeEditCmdType,
            ClientId:       "{8F3A2B6E-1C2D-4E5F-9A1B-2C3D4E5F6A7B}",
            DescriptionText: "Show a hello dialog",
            ToolTipText:     "Hello",
            StandardIcon:    null,
            LargeIcon:       null,
            ButtonDisplay:   ButtonDisplayEnum.kNoTextWithIcon);

        helloButton.OnExecute += _ =>
            System.Windows.MessageBox.Show("Hello from your add-in.");

        if (firstTime)
        {
            var ribbon = app.UserInterfaceManager.Ribbons["Part"];
            var tab = ribbon.RibbonTabs.Add(
                "Hello", "HelloAddin.Tab", "{8F3A2B6E-1C2D-4E5F-9A1B-2C3D4E5F6A7B}");
            var panel = tab.RibbonPanels.Add(
                "Greeting", "HelloAddin.Panel", "{8F3A2B6E-1C2D-4E5F-9A1B-2C3D4E5F6A7B}");
            panel.CommandControls.AddButton(helloButton, true);
        }
    }

    public void Deactivate()
    {
        helloButton = null;
        app = null;
        GC.Collect();
        GC.WaitForPendingFinalizers();
    }

    public void ExecuteCommand(int commandID) { }

    public object Automation => null!;
}

[ComVisible(true)] and [Guid(...)] are required for Inventor to find the class. The Guid is the CLSID that Inventor reads from the .addin manifest and uses to instantiate the type. The same Guid string appears in four places — the [Guid] attribute on the class, the manifest's <ClassId> element, the manifest's <ClientId> element, and the ClientId: argument to AddButtonDefinition (in braces) — and they all need to match exactly. A mismatched Guid produces no error and no diagnostic; the add-in simply doesn't load.

Activate is called once per Inventor session. The firstTime flag is true only on the very first activation after the add-in is installed — subsequent Inventor sessions still call Activate, but with firstTime=false. Inventor caches ribbon definitions across sessions, so creating a panel or tab unconditionally on every Activate call would create a duplicate on every Inventor restart. The pattern is: create button definitions unconditionally (Inventor uses them to wire up the cached ribbon controls); gate ribbon-panel and tab creation on firstTime. The ButtonDefinition outlives the activation call because Inventor holds a COM reference to it.

Deactivate is called when the add-in is unloaded. Inventor's COM marshalling keeps add-in objects alive past the unload call, so the field references need to be nulled and a garbage collection forced before the marshalling tables release them. Without the GC, the add-in's assembly remains pinned; reactivating from the Add-In Manager then produces late-binding errors that look like the add-in is partially loaded. The two GC calls flush the runtime's COM RCW table.

ExecuteCommand is a legacy method from before button definitions existed; it can be empty. Automation is the hook other add-ins use to call into this one; returning null is fine until there's a reason to expose something.

The manifest

<?xml version="1.0" encoding="utf-8"?>
<Addin Type="Standard">
  <ClassId>{8F3A2B6E-1C2D-4E5F-9A1B-2C3D4E5F6A7B}</ClassId>
  <ClientId>{8F3A2B6E-1C2D-4E5F-9A1B-2C3D4E5F6A7B}</ClientId>
  <DisplayName>Hello Addin</DisplayName>
  <Description>The smallest possible Inventor add-in.</Description>
  <Assembly>HelloAddin.dll</Assembly>
  <LoadOnStartUp>1</LoadOnStartUp>
  <UserUnloadable>1</UserUnloadable>
  <Hidden>0</Hidden>
  <SupportedSoftwareVersionGreaterThan>29..</SupportedSoftwareVersionGreaterThan>
  <SupportedSoftwareVersionLessThan>31..</SupportedSoftwareVersionLessThan>
</Addin>

ClassId and ClientId carry the same Guid — both reference the COM-visible class. They're separate elements for historical reasons; for a single-class add-in they always match.

The SupportedSoftwareVersion* brackets declare which Inventor versions are allowed to load the add-in. The number is Inventor's release identifier: Inventor 2024 is 28, 2025 is 29, 2026 is 30, 2027 is 31. The brackets above (>29.. and <31..) say "version 30 only" — Inventor 2026 alone — because both bounds are strict. For a span across 2024 through 2026, use >27.. and <31... Widening or narrowing the supported range is worth a quick double-check.

LoadOnStartUp=1 makes Inventor load the add-in at process start; without it the user has to flip the toggle in the Add-In Manager once per session. UserUnloadable=1 lets the user disable it from the manager. Hidden=0 makes it visible there at all; Hidden=1 is normally only used for system add-ins that exist purely as dependencies for other add-ins.

Where it goes on disk

%APPDATA%\Autodesk\ApplicationPlugins\HelloAddin\
├── HelloAddin.dll
├── HelloAddin.comhost.dll
└── HelloAddin.Inventor.Addin

Inventor scans two folders at process start: %APPDATA%\Autodesk\ApplicationPlugins\ (per-user) and %PROGRAMDATA%\Autodesk\ApplicationPlugins\ (machine-wide). It recurses into every subfolder and reads every *.addin manifest it finds.

For a developer iterating on a build, the AppData path is convenient: no UAC prompt, no admin shell, no install step. A post-build target that copies $(TargetDir) into the AppData folder makes "build" the deploy. Inventor doesn't watch the folder, so each iteration cycle is build → restart Inventor → see the change.

What this add-in is missing

The add-in above is enough to put a working button on the Inventor ribbon. It doesn't have the structure to grow into something maintainable:

  • Every service the button calls is constructed inline in the click handler. There's no dependency injection and no testable seam.
  • There's no logger; crashes leave no trace.
  • There's no settings store; any state the user sets is lost when Inventor restarts.
  • A second add-in on the same machine shares no code with this one.
  • A second Inventor version requires a second copy of the project; nothing in the build is parameterised on the Inventor year.
  • The xcopy-to-AppData deploy is fine for a developer, but it isn't an installer a customer can run.

The rest of the series adds each of these layers. The next post is the one this baseline most obviously calls for: an IHost-backed DI container and a Serilog logger, built on Activate, disposed on Deactivate, still in a single csproj.


The add-in above loads, shows a button, and does nothing else. It's the baseline the rest of the series builds on. Where the series ends up is public: the Inventor add-in template and the BasAutomation.Inventor libraries it builds on, both MIT.

Comments

Leave a comment

We'll send a one-time email to verify it's you. Your address is never shown publicly and isn't used for marketing.

Used only to verify your comment.