Inventor .NET 6 Add-In (.NET Core followup version)

Inventor .NET 6 Add-In (.NET Core followup version)

pockybum522
Enthusiast Enthusiast
5,692 Views
24 Replies
Message 1 of 25

Inventor .NET 6 Add-In (.NET Core followup version)

pockybum522
Enthusiast
Enthusiast

Hello All,

 

I've been poking at making a .NET 6 add-in for Inventor for a while. Most of my attempts resulted in something that wouldn't load, but finally I have something worth sharing. 

 

GITHUB:

https://github.com/PockyBum522/template-inventor-core-addin

 

WHY: 

Going forward, .NET 6 is the version that is getting new features. .NET framework still exists, and I believe will get security updates, but you are limited to lower versions of the C# language when making add-ins. 

 

Between the above, performance improvements, and many other well-documented advantages to using .NET 6, I wanted to see if it was possible to make an Add-In with a .NET 6 project that could load in Inventor.

 

Behold:

pockybum522_0-1629196739715.png

 

HOW:

To test this out, check out the github project and look at readme.md for full instructions.

 

Once you have built the project and copied the files per readme.md's instructions, you should be able to open a part, and click on Tools > Core Addin Show Partname and have it show the filename like in the first screenshot.

 

I offer absolutely no warranty on this, and I don't even know if it's useful or if there will be restrictions on what you can put into your Add-In and still have it work. I mostly just wanted to share it as I haven't seen a working .NET 6 addin on the forums, and wanted to both let AutoDesk know there is demand for it + get people playing around with it to learn more.

 

Tested with: Visual Studio 2022 17.1.2 and Inventor 2022 Build 287, 2022.2.2

 

Thanks

5,693 Views
24 Replies
Replies (24)
Message 21 of 25

yan.gauthier
Advocate
Advocate

Hi,

 

I personally don't use the documentType. I always test with something like:

 

if (invApp.ActiveEditDocument is PartDocument partDocument)
{
    // you now have the variable of type PartDocument!
}

 

As for office. The only things I do is read and write to Excel which I go by using OpenXml. one of my collegue uses FastExcel.

 

Also, we took advantage of .Net 6 MAUI and now are using BlazorWebView for our UI. This allow us to reuse the same tools and UI for our ERP interactions in both Inventor and our own cloud services. .NET 6 is also marginally faster than .NET48 which is a nice plus. Oh and C#9 is a nice upgrade on C#7.1

 

But I get your point .NET48 feels more stable. We made the jump in order to mix our cloud and inventor development. 

Message 22 of 25

pockybum522
Enthusiast
Enthusiast

Just a heads up, I renamed the repo. I think I updated all links properly in this thread, but just in case, here:

 

https://github.com/PockyBum522/template-inventor-core-addin

Message 23 of 25

TCARPENTER21
Enthusiast
Enthusiast

Anyone have this working in Inventor 2023 yet?  My post build events aren't working, but I copied them over manually, and I think I've got all the 2022 references switched to 2023.  I don't get any errors, but I don't get the button or the add-in in the add-in list.

 

What am I missing?

0 Likes
Message 24 of 25

TCARPENTER21
Enthusiast
Enthusiast

NVM - duh.  Got it, may brain turned on - change the name of the CoreAddIn.Inventor.addin (Put me in C-ProgramData-Autodesk-Inventor Addins)... At least it's Friday.

0 Likes
Message 25 of 25

TA.Fehr
Advocate
Advocate

A bit of a resurrection.
Has anyone run into the problem of running multiple .net core add-ins in 2024 and earlier?
Whenever I run more than one add-in, the second one gets automatically unloaded. I checked to make sure there were no shared GUID's from copying the sample file, but I still can't seem to get more than one loaded at any time.

I can run multiple add-ins in 2025, but nothing earlier.

@Andrew.WhiteBEDAD, you said you have migrated multiple add-ins. Are you having an conflicts?

0 Likes