Share

Port .Net Framework-based project to .Net

Inventor 2025  has migrated from .Net Framework to .Net 8, it is recommended to port the .Net Framework-based projects to .Net 8 to keep compatibility. This article demonstrates how to port Inventor VB.net/C# projects from .Net Framework-based to .Net 8-based, and also C++/CLI settings for C++ projects which use managed code.

Environment Preparation:

  1. Visual Studio:

    Install Visual Studio 17.8 or later version which supports targeting .Net 8.0 SDK, refer to the Version requirements for .NET 8 SDK.

  2. .Net 8.0 SDK:

    Install .Net 8.0 SDK, refer to the Download .NET SDKs for Visual Studio.

  3. .NET Upgrade Assistant:

    Install the Visual Studio extension “.NET Upgrade Assistant”, refer to Install the .NET Upgrade Assistant:


Port to .Net 8 process (C# and VB.net projects)

  1. Open an Inventor project (below is based on a simple VB.net Inventor addin as example, which is targeted to .Net Framework 4.8).


  2. Right click the project, and choose Upgrade command:

  3. Choose “Upgrade project to a newer .NET version”:

  4. Choose “In-place project upgrade”, and click Next:

  5. Choose “.NET 8.0” and click Next:

  6. Select all if you are not sure which ones need to migrate and click Upgrade selection:

  7. Now the migration result is as below:

  8. Check the Project Properties the Target framework is .NET 8.0 now:

  9. Re-reference Autodesk.Inventor.interop.dll from C:\Program Files\Autodesk\Inventor 2025\Bin\ folder, and set the “Embed Interop Types” to False, “Copy Local” to True:

  10. Edit the InventorAddinSample.vbproj using a text editor, and delete the below <PostBuildEvent> tag for Post Build Event:

  11. Add below <PropertyGroup> tag to <Project> for embedding manifest file to the result binary:
    <PropertyGroup>
      <ApplicationManifest>$projectname$.X.manifest</ApplicationManifest>
    </PropertyGroup>
  12. Recompile the project:


  13. Deploy your addin to proper locations:

    Place the Autodesk.InventorAddinSample.Inventor.addin to C:\Program Files\Autodesk\Inventor 2025\Bin\Addins\ folder.

    Place the binary \InventorAddinSample\bin\Debug\net8.0-windows7.0\InventorAddinSample.dll to C:\Program Files\Autodesk\Inventor 2025\Bin\ folder.

  14. Launch Inventor and check if the addin now can be loaded successfully.

Port to .Net 8 process (C++/CLI properties in C++ projects)

This is for a C++ project has C++/CLI properties set for managed code. As the “.NET Upgrade Assistant” tool doesn’t work for C++/CLI upgrade in C++ projects, below steps demonstrate how to upgrade the C++/CLI properties manually.

  1. Open project in Visual Studio, right click the project and choose Properties command.

  2. Navigate to Advanced:


  3. Change the Common Language Runtime Support to .NET Core Runtime Support (/clr:netcore) from the dropdown list, then click Apply button:


  4. Change the .Net Core Target Framework to .NET 8.0 from the dropdown list, and click OK button:


  5. Open the project file using text editor, delete the system references:


  6. Add framework references to WPF/WinForm is necessary, such as:

    <!-- Reference all of WPF -->
    <FrameworkReference Include="Microsoft.WindowsDesktop.App.WPF" />
    

  7. Search if there are individual files have the “CompileAsManaged” property. Remove it as this property will cause build error and the files are compiled as managed by default:

    <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsManaged>
    

  8. Navigate to project properties page, and go to C/C++->General, and choose No Common Language Runtime Support for Common Language Runtime:


  9. Navigate to Precompiled Headers, choose Not Using Precompiled Headers for Precompiled Header:


  10. Reference Autodesk.Inventor.interop.dll from C:\Program Files\Autodesk\Inventor 2025\Bin\.


  11. Rebuild project and deploy the binaries and check if everything works.


More infomation:

More infomation can be found from Autodesk Beta Forum page :.Net Framework based Inventor projects upgrade to .Net 8 - (Inventor 2025)



Was this information helpful?