# Net7 plugin fails to load if it was loaded already

**URL:** <https://discourse.mcneel.com/t/net7-plugin-fails-to-load-if-it-was-loaded-already/208500>\
**Category:** Rhino Developer\
**Tags:** windows, net7\
**Created:** [August 14, 2025, 4:44pm UTC](https://discourse.mcneel.com/t/net7-plugin-fails-to-load-if-it-was-loaded-already/208500 "2025-08-14T16:44:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Goswin](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/goswin/32/486365_2.png) [@Goswin](https://discourse.mcneel.com/u/Goswin)\
**Post date:** [August 14, 2025, 4:44pm UTC](https://discourse.mcneel.com/t/net7-plugin-fails-to-load-if-it-was-loaded-already/208500/1 "2025-08-14T16:44:21Z")

</div>

On `net7`, the second time loading [my plugin](https://www.food4rhino.com/en/app/fesh) it fails to find `FSharp.Core`.

The first time loading all is good.

After reverting to `net48` runtime and back to `net7` it works again, but just once. After restarting rhino it fails to load. (Staying on `net48` it works)

What happens when a plugin is first loaded?

@eirannejad Did you say once `FSharp.Core` is preloaded in Rhino ?

```auto
System.IO.FileNotFoundException: Could not load file or assembly 'FSharp.Core, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'FSharp.Core, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at System.ModuleHandle.ResolveType(QCallModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
   at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
   at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
   at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(MetadataToken caCtorToken, MetadataImport& scope, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1& derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctorWithParameters, Boolean& isVarArg)
   at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder`1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1 derivedAttributes)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType)
   at Rhino.Runtime.HostUtils.CreatePlugIn(Type pluginType, Assembly pluginAssembly, Boolean printDebugMessages, Boolean useRhinoDotNet)
   at Rhino.Runtime.HostUtils.CreatePlugIn(Type pluginType, Boolean printDebugMessages)
   at Rhino.PlugIns.PlugIn.CreateFromAssembly(Assembly pluginAssembly, Boolean displayDebugInfo, Boolean useRhinoDotNet)
Unable to load Fesh.Rhino.rhp plug-in: initialization failed.

```

(Rh 8.23.25224.02001 on Windows)

---

<div class="post-metadata">

**Author:** ![barden00](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/barden00/32/587603_2.png) [@barden00](https://discourse.mcneel.com/u/barden00)\
**Post date:** [December 9, 2025, 12:50am UTC](https://discourse.mcneel.com/t/net7-plugin-fails-to-load-if-it-was-loaded-already/208500/2 "2025-12-09T00:50:10Z")

</div>

I am intrigued by F# and would like to try Fesh with Rhino, but this situation with .NET Core is somewhat messing up my work environment. Has there been any news on this topic?

---

<div class="post-metadata">

**Author:** ![Goswin](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/goswin/32/486365_2.png) [@Goswin](https://discourse.mcneel.com/u/Goswin)\
**Post date:** [December 9, 2025, 9:27am UTC](https://discourse.mcneel.com/t/net7-plugin-fails-to-load-if-it-was-loaded-already/208500/4 "2025-12-09T09:27:00Z")

</div>

Yes, I really enjoy scripting with F#. (My Python scripts just grew too large.) However, issues with dll loading keep on popping up, in Fesh.Revit too. I might try to use IL Merge to bundle all references into one dll. Just like other F# tools are doing it: [Paket/build.fsx at 1054e37e45e75a6ed8c33c76e66fe83bc4d0fcbe · fsprojects/Paket · GitHub](https://github.com/fsprojects/Paket/blob/1054e37e45e75a6ed8c33c76e66fe83bc4d0fcbe/build.fsx#L321)

but if you stay on net48 Fesh in Rhino should work fine

---

<div class="post-metadata">

**Author:** ![Goswin](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/goswin/32/486365_2.png) [@Goswin](https://discourse.mcneel.com/u/Goswin)\
**Post date:** [December 14, 2025, 9:51pm UTC](https://discourse.mcneel.com/t/net7-plugin-fails-to-load-if-it-was-loaded-already/208500/5 "2025-12-14T21:51:02Z")

</div>

still the same problem 😬

> <https://github.com/goswinr/Fesh.Rhino/issues/20>
>
> 0.29.0 and older versions currently, only works on NET Framework runtime of Rhin…o.
> 
> On .NET core 8.0 fails with:
> \`System.IO.FileNotFoundException: Could not load file or assembly 'FSharp.Core, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.\`
> 
> Rhino Version 8 SR25
> (8.25.25328.11001, 2025-11-24)
> 
> see
> https://discourse.mcneel.com/t/net7-plugin-fails-to-load-if-it-was-loaded-already/208500
> too

@curtisw @eirannejad Did you say once `FSharp.Core` is preloaded in Rhino ?

---

<div class="post-metadata">

**Author:** ![Goswin](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/goswin/32/486365_2.png) [@Goswin](https://discourse.mcneel.com/u/Goswin)\
**Post date:** [December 17, 2025, 11:46am UTC](https://discourse.mcneel.com/t/net7-plugin-fails-to-load-if-it-was-loaded-already/208500/6 "2025-12-17T11:46:19Z")

</div>

using `dotnet publish --self-contained` instead of `dotnet build` fixed it.
