Inventor 2025 brings us a big change. The API has migrated from .Net Framework to .Net core 8. And it's recommended to port all our addins to ".Net Core 8". I migrated a couple of my addins using a guideline but it was not as complete as I would like. Therefore I wrote down what worked for me in this post. (The official Autodesk article can be found here.)

Updating your solution consists of the following steps. However, you aren't guaranteed to be finished after these steps. I have seen solutions that, after migrating, ended with a lot of errors in the code. In some cases, I just needed to add an import statement. In other cases, there was a lot of work to do.

Preparing Visual Studio

To create ".Net Core 8" addins you need Visual Studio 2022 (17.8) or later. I assume you have installed Visual Studio 2022. To update to version 17.8 (or later) you can select "Help" and then "Check for Updates". After that, you need to install ".Net Core 8". Select "Tools" and then "Get Tools and Features".

Now select the tab "Individual components" and tick ".Net 8.0 Runtime (Long Term Support)" then hit "Install".

Microsoft created an addin for Visual Studio that can help you with the migration. Therefore the next thing to do is install that addin. Select "Extensions" and "Manage Extensions...".

Now search for the extension ".NET Upgrade Assistant" and install it.

Upgrading a project.

You only need to update Visual Studio and install the ".NET Upgrade Assistant" only once. However, the following steps need to be done/checked for each project in each solution.

.NET Upgrade Assistant

The biggest changes are done by the ".NET Upgrade Assistant". You can start it by right-clicking your project and selecting "Upgrade".

Now use the default settings and click next...

Make sure everything is selected.

Everything was upgraded except references to the Autodesk dll’s. (We need to add those later to the project again.)

Add (lost) references/Nuget packages

Most references will get lost during the upgrade. But they needed to be changed anyway. Adding the references works like it used to work by right-clicking the "Dependencies" in your project and selecting "Add project reference".

Then you need to browse all DLLs that your project needs to reference.

  • C:\Program Files\Autodesk\Inventor [VERSION]\Bin\Autodesk.Inventor.Interop.dll
    • This is always needed for Inventor addins and tools that use Inventor.
  • C:\Program Files\Autodesk\Inventor [VERSION]\Bin\stdole.dll
    • Needed if you use icons for your buttons
  • C:\Program Files\Autodesk\Inventor [VERSION]\Bin\Autodesk.iLogic.Interfaces.dll
    C:\Program Files\Autodesk\Inventor [VERSION]\Bin\Autodesk.iLogic.Runtime.dll
    • Needed if you use iLogic functions in your addin. If you used my tutorial as the base for your addin you likely need these

For the Autodesk.Inventor.Interop.dll reference you need to set the properties “Embed Interop Types” to "False", “Copy Local” to "True"

Because .Net core 8 is a cross-platform framework it does not reference the default Windows dll's anymore. This is one of the major differences between ".Net framework 4.8" and ".Net Core 8". Adding all these default Windows dll's would be a lot of work. Luckily enough Visual Studio has a great way to add packages of dll's. (Here we will only use the default Microsoft Windows packages but there are a lot of other packages that could be useful.) Another advantage of using NuGet packages is that they are much more easy to update. Therefore it would be so nice if Autodesk would add their dll's in a package. That would save us the previous step of adding new references each time Autodesk releases a new Inventor version. Therefore there is a post on the Inventor-Ideas forum "Inventor API on NuGet". I would highly recommend everyone to vote for that "Idea"!

Anyway for almost all addins you need the package "System.Drawing.Common". (The only situation I can think of that you don't need it, is when you don't use any icons or forms in your addin...) Therefore select "Tools", "NuGet package manager" and "Manage NuGet packages for solution..."

Search for the package "System.Drawing.Common" and install it for the projects in your solution that need it.

Check/update project settings.

The ".NET Upgrade Assistant" is not that perfect and I found that you always need to check some project settings. Therefore go to the project settings by right-clicking on your project and selecting "Properties". (Or select your project and press Alt+Enter). Check:

  • The "Output type" is "Class library" for your addin project.
  • The "Target framework" is "8.0"
  • The "Target OS" is "Windows". I have seen multiple cases where this was not set correctly!

In the past, I did set the output directory (when debugging) to the location that Inventor expect the files. If you build a ".Net core 8" with Visual Studio then it will always create an extra folder "net8.0-windows" in your output directory. This breaks the Inventor logic to find your addin files. Therefore it's no longer an option to output your files directly to a directory that Inventor expects. That means that we need to copy the files needed by Inventor (automatically) to the correct location. What that location is has also changed sins Inventor 2024. These are the (new) locations.

  • All Users, Version Independent
    • %ALLUSERSPROFILE%\Autodesk\Inventor Addins\
  • All Users, Version Dependent
    • %PROGRAMFILES%\Autodesk\Inventor 20xx\Bin\Addins\
      • Before Inventor 2024 this used to be %ALLUSERSPROFILE%\Autodesk\Inventor 20xx\Addins\ folder)
      • I noticed that you need local admin rights on your computer to write to this folder. If you don't have those "rights" then Visual Studio will stop the building process when you try to debug your addin!
  • Per User, Version Dependent
    • %APPDATA%\Autodesk\Inventor 20xx\Addins\
  • Per User, Version Independent
    • %APPDATA%\Autodesk\ApplicationPlugins

You need to copy at least the *.addin file and you addin dll file to one of these locations. You can do that by adding the following lines to the "Post-build events".

XCopy "$(TargetPath)" "[TARGET LOCATION]\$(TargetName)\" /Y /R
XCopy "$(ProjectDir)[YOUR ADDIN NAME].addin" "[TARGET LOCATION]\$(TargetName)\" /Y /R

Make sure you change the information between the [square brackets].

Other (official) guides will tell you to use the following. I found it not useful. But because it's the official code I will add it here as a reference:

WHERE MT.EXE 
IF ERRORLEVEL 1 call "$(DevEnvDir)..\..\VC\Auxiliary\Build\vcvarsall.bat" amd64 
mt.exe -manifest "$(ProjectDir)InventorAddinSample.X.manifest" 
outputresource:"$(TargetPath)";#2 
XCopy "$(TargetPath)" "%AppData%\Autodesk\ApplicationPlugins\$(TargetName)\" /Y /R 
XCopy "$(ProjectDir)Autodesk.InventorAddinSample.Inventor.addin" "%AppData%\Autodesk\ApplicationPlugins\$(TargetName)\" /Y /R 

Set Inventor as a startup program for debugging

I found that the ".NET Upgrade Assistant" does not correctly convert the startup application. (Or to be more accurate it was not converted just removed...) That is a problem for debugging. The settings used to be in the project properties but they have moved to the "Debug properties". Select "Debug" and then "[YOUR PROJECT] debug properties". (Or do some clicking)

On all the migrations that I did, I noticed that it was impossible to set up the startup application. Therefore it's safe to delete the existing profile.

After that, you will need to add a new “Executable debug profile”.

In this new profile, you can add the path to Inventor.

Check the project file.

Usually, I would not edit this file directly but it's possible to set some settings here that I could not set with the GUI. You can edit the project file by double-clicking on your project in the Solution Explorer.

You will find an XML file. In that file, you need to check/do the following.

  • If you are using WPF forms in your project then you should find the following line in the first "PropertyGroup". If not then add it.
    • <UseWPF>true</UseWPF>
  • If you are using WindowsFormsforms in your project then you should find the following line in the first "PropertyGroup". If not then add it.
    • <UseWindowsForms>true</UseWindowsForms>
  • Delete system references.
    • If you find an "ItemGroup" with "Import" nodes looking like this then you can remove it. (The includes can be different on your project.)
<ItemGroup>
	<Import Include="System.Windows" />
	<Import Include="System.Windows.Controls" />
	<Import Include="System.Windows.Data" />
	<Import Include="System.Windows.Documents" />
	<Import Include="System.Windows.Input" />
	<Import Include="System.Windows.Shapes" />
	<Import Include="System.Windows.Media" />
	<Import Include="System.Windows.Media.Imaging" />
	<Import Include="System.Windows.Navigation" />
</ItemGroup>
  • Delete any "PropertGroup" with a "Condition" that looks like this.
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DefineDebug>false</DefineDebug>
    <IncrementalBuild>false</IncrementalBuild>
    <DocumentationFile>MyILogicAddin.xml</DocumentationFile>
    <NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn>
  </PropertyGroup>

Create Class "Marshal2".

In any (test) applications you might have used the static class "Marshal" to get the Inventor object. It will look something like this:

Dim inventorObject As Inventor.Application = Marshal.GetActiveObject("Inventor.Application")

In .Net core 8 you will get an error message: "GetActiveObject' is not a member of 'Marshal". (The method has been removed The way to solve this is to create your own implementation of the GetActiveObject method. I did not write the following code I just translated the code I found (here) from C# to VB.Net. When you add this class to your project then you just need to add a "2" to every line where you use the "Mashal" class. Something like this:

Dim inventorObject As Inventor.Application = Marshal2.GetActiveObject("Inventor.Application")

This is the actual class.

Imports System.Runtime.InteropServices
Imports System.Runtime.Versioning
Imports System.Security

Module Marshal2
    Friend Const OLEAUT32 As String = "oleaut32.dll"
    Friend Const OLE32 As String = "ole32.dll"

    <System.Security.SecurityCritical>
    Public Function GetActiveObject(ByVal progID As String) As Object
        Dim obj As Object = Nothing
        Dim clsid As Guid

        Try
            CLSIDFromProgIDEx(progID, clsid)
        Catch __unusedException1__ As Exception
            CLSIDFromProgID(progID, clsid)
        End Try

        GetActiveObject(clsid, IntPtr.Zero, obj)
        Return obj
    End Function

    <DllImport(OLE32, PreserveSig:=False)>
    <ResourceExposure(ResourceScope.None)>
    <SuppressUnmanagedCodeSecurity>
    <System.Security.SecurityCritical>
    Private Sub CLSIDFromProgIDEx(<MarshalAs(UnmanagedType.LPWStr)> ByVal progId As String, <Out> ByRef clsid As Guid)
    End Sub


    <DllImport(OLE32, PreserveSig:=False)>
    <ResourceExposure(ResourceScope.None)>
    <SuppressUnmanagedCodeSecurity>
    <System.Security.SecurityCritical>
    Private Sub CLSIDFromProgID(<MarshalAs(UnmanagedType.LPWStr)> ByVal progId As String, <Out> ByRef clsid As Guid)
    End Sub

    <DllImport(OLEAUT32, PreserveSig:=False)>
    <ResourceExposure(ResourceScope.None)>
    <SuppressUnmanagedCodeSecurity>
    <System.Security.SecurityCritical>
    Private Sub GetActiveObject(ByRef rclsid As Guid, ByVal reserved As IntPtr, <Out> <MarshalAs(UnmanagedType.[Interface])> ByRef ppunk As Object)
    End Sub
End Module

Recap

In the basic updating, your solution consists of the following steps. I guess that this is all you need after your first upgrade.

  1. Preparing Visual Studio.
    • This step needs to be done only once.
  2. Use the ".NET Upgrade Assistant"
    • Use the default settings.
  3. Add references/Nuget packages
    • Reference: C:\Program Files\Autodesk\Inventor 2025\Bin\Autodesk.Inventor.Interop.dll
      •  Set the “Embed Interop Types” to "False", “Copy Local” to "True"
    • Reference: C:\Program Files\Autodesk\Inventor 2025\Bin\stdole.dll
    • Nuget package: System.Drawing.Common
  4. Check/update project settings.
    • Output type: Class library.
    • Target framework: .Net 8.0
    • Target OS: Windows.
    • Post-build events:
      • XCopy "$(TargetPath)" "[TARGET LOCATION]\$(TargetName)\" /Y /R
        XCopy "$(ProjectDir)[YOUR ADDIN NAME].addin" "[TARGET LOCATION]\$(TargetName)\" /Y /R
    • Possibilities for [TARGET LOCATION]
      • All Users, Version Independent
        • %ALLUSERSPROFILE%\Autodesk\Inventor Addins\
      • All Users, Version Dependent
        • %PROGRAMFILES%\Autodesk\Inventor 20xx\Bin\Addins\
      • Per User, Version Dependent
        • %APPDATA%\Autodesk\Inventor 20xx\Addins\
      • Per User, Version Independent
        • %APPDATA%\Autodesk\ApplicationPlugins 
  5. Set Inventor as a startup program for debugging
    • C:\Program Files\Autodesk\Inventor 2025\Bin\Inventor.exe
  6. Other small changes.
    • WPF: Add <UseWPF>true</UseWPF> to first PropertyGroup
    • Winforms: Add<UseWindowsForms>true</UseWindowsForms> to first PropertyGroup
    • Delete system references.
    • Delete old configurations
  7. Create Class "Marshal2".

 

Skills:

Autodesk Inventor, Vault, Git, C#, vb, .net, php HTML, css, js

Education:

University computer science.
HBO Mechanical engineer.
MBO Fine mechanics.

Experience:

Programmer and Mechanical engineer at Kelvion
(2016 - 20..)

Mechanical engineer at Strukton
(2009 - 2016)

Mechanical engineer at RDG-engineering
(2007 - 2009)

CNC Programmer at VMC
(2005 - 2007)

volunteer at Taizé
(2007)

Certifications:

Objectgeoriënteerd analyseren en ontwerpen, Objectgeoriënteerd programmeren in Java, Webapplicaties: de clientkant, Databases, Security Aware Programmer, Web Security Specialist