RhinoCommon 7 Plugin no longer loading assemblies in V8

I have a RhinoCommon plugin which was working fine in V7, but when trying to run it on Rhino 8, I get assembly resolution errors like this:

System.IO.FileNotFoundException: Could not load file or assembly ‘OneOf, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. The system cannot find the file specified.
File name: ‘OneOf, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at Rhino.PlugIns.PlugIn.CreateFromAssembly(Assembly pluginAssembly, Boolean displayDebugInfo, Boolean useRhinoDotNet)

It appears to happen for nuget package references in my plugin project.

Is there something special which needs to happen in V8 to get it to find my referenced assemblies?

Adding this to my plugin project’s .csproj file seems to have fixed it:

<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
1 Like

Having refactored my plugin project to use less dependencies, I now get this error when I try and hit my compute endpoint:

—> System.IO.FileLoadException: Could not load file or assembly ‘Microsoft.Extensions.Configuration.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60’. Could not find or load a specific file. (0x80131621)
File name: ‘Microsoft.Extensions.Configuration.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60’
—> System.IO.FileLoadException: Could not load file or assembly ‘Microsoft.Extensions.Configuration.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60’.
at System.Runtime.Loader.AssemblyLoadContext.g____PInvoke|5_0(IntPtr ptrNativeAssemblyBinder, UInt16* ilPath, UInt16* niPath, ObjectHandleOnStack retAssembly)
at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
at Rhino.Runtime.HostUtils.LoadAssemblyFrom(String path)
at Rhino.Runtime.HostUtils.LoadFromResolveHandler(Object sender, ResolveEventArgs args)
at System.Runtime.Loader.AssemblyLoadContext.InvokeResolveEvent(ResolveEventHandler eventHandler, RuntimeAssembly assembly, String name)

That assembly is sitting where all the other assemblies which are loading ok are. When I write a console app which just attempts to Assembly.LoadFrom(…) that same dll, it loads fine.

Anyone have any insights on what might be causing this issue with that MS package’s assembly?

And in general, for plugins that require other DLL’s to run, are those DLL’s all getting copied into the rhino Plugins folder, or is there some other reference resolution mechanism I should be using?

Turned out that the compute.geometry project had nuget package references to older versions of the packages being used by my plugin. Once all the packages were at the same version, all loaded swimingly.