Inventor Addins and Assembly Binding Redirect... Ew.
For those of you brave souls who have ventured forth into the wild and wacky world of writing plugins for Autodesk Inventor, you may have run into some baffling issues while trying to use 3rd party packages, and I want to throw this out so that if any of you have this issue, you can benefit from me battling the bewilderment.
I'm currently writing a plugin for inventor using mostly FSharp. Yeah, you can do that, and yeah, it's totally amazing, like any use of FSharp.
So in my fervor and masocistic need to never settle for the bare minimum, I decided it would be amazing to use the Elmish Model-View-Update style of doing things, using Elmish and Elmish.WPF for creating my user interface.
And.. it IS amazing, but ..
Well instead of being able to use the very latest and greatest available to us, since Inventor itself is still in the .NetFramework land instead of the new hotness of .Dotnet 6 and beyond, we have no choice but to use some funky work arounds when using third party libraries.
For instance, for whatever reason, Inventor addins seemingly CANNOT use any other version of FSharp.Core than 4.6.2 if you plan to also use Elmish.WPF. Doesn't seem to make much sense, but there we go, cannot be done. Fine, it's ok, I can just use an older version of the language, that's ok. except that if you try to combine Elmish.WPF and something like FSharp.Interop.Dynamic which relies on an OLDER version of FSharp.Core, when you try to run it as an inventor plugin, you get an exception.
The way you solve this shenanigan is to alter the Inventor.exe.config file, located usually at C:\Program Files\Autodesk\Inventor 2023\Bin
Mine now looks like this:
Now, this means that if I'm going to be able to have anyone at my company use this plugin, I'm going to have to create some sort of installer that will alter this file on everyone's machine, but.. there's nothing else I can do. If this was .Net6.0 then it would just work. It would assume the latest version of the dll it finds is fine, and go with that. I'm hoping they migrate Inventor sometime in the near future, hahaha.

Comments
Post a Comment