Skip to content

F# Interactive uses different FSharp.Core version to latest SDK #20038

Description

@mrboring

Please provide a succinct description of the issue.

Clash of .NET versions.

Library compiles without issues. When called from an fsx file an exception occurs.

The publish directory for the library contains FSharp.Core 10.1.0.0.
F# Interactive loads FSharp.Core 10.0.0.0.

Repro steps

Provide the steps required to reproduce the problem:

  1. Created a library with SDK 10.0.109
  2. Called the library from an fsx file
  3. dotnet fsi scriptname.fsx

Expected behavior

I expected the fsx file to execute without errors.

Actual behavior

$ dotnet fsi testing-fsharp-core-issue.fsx
System.TypeInitializationException: The type initializer for 'MBUtilities.CrossPlatform.Constants' threw an exception.
 ---> System.TypeInitializationException: The type initializer for '<StartupCode$MBUtilities>.$MBUtilities.CrossPlatform' threw an exception.
 ---> System.IO.FileLoadException: Could not load file or assembly 'FSharp.Core, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)
File name: 'FSharp.Core, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
 ---> System.IO.FileLoadException: Could not load file or assembly '/home/<removed>/Data/FSharp/Projects/MBUtilities/Publish/FSharp.Core.dll'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)
File name: '/home/<removed>/Data/FSharp/Projects/MBUtilities/Publish/FSharp.Core.dll'
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyBinder, String ilPath, String niPath, ObjectHandleOnStack retAssembly)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
   at System.Reflection.Assembly.LoadFromResolveHandler(Object sender, ResolveEventArgs args)
   at System.Runtime.Loader.AssemblyLoadContext.InvokeResolveEvent(ResolveEventHandler eventHandler, RuntimeAssembly assembly, String name)
   at <StartupCode$MBUtilities>.$MBUtilities.CrossPlatform..cctor() in /home/<removed>/Data/FSharp/Projects/MBUtilities/src/MBUtilities/MBUtilities.CrossPlatform.fs:line 12
   --- End of inner exception stack trace ---
   at MBUtilities.CrossPlatform.Constants..cctor()
   --- End of inner exception stack trace ---
   at MBUtilities.CrossPlatform.Constants.get_ds()
   at <StartupCode$FSI_0001>.$FSI_0001.main@() in /home/<removed>/Data/FSharp/Projects/MBUtilities/DO NOT COMMIT/Scripts/testing-fsharp-core-issue.fsx:line 4
   at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
Stopped due to error

Known workarounds

Remove the FSharp.Core (actually renamed it) file from the publish directory.

Related information

Provide any related information (optional):

  • Operating system

Linux Mint 22.3

  • .NET Runtime kind (.NET Core, .NET Framework, Mono)
$ dotnet --list-sdks 
9.0.118 [/usr/lib/dotnet/sdk]
10.0.109 [/usr/lib/dotnet/sdk]
  • Editing Tools (e.g. Visual Studio Version, Visual Studio)
Visual Studio Code 
Version: 1.127.0
Commit: 4fe60c8b1cdac1c4c174f2fb180d0d758272d713
Date: 2026-06-30T10:52:33+02:00
Electron: 42.2.0
ElectronBuildId: 14159160
Chromium: 148.0.7778.97
Node.js: 24.15.0
V8: 14.8.178.14-electron.0
OS: Linux x64 6.17.0-35-generic

Metadata

Metadata

Assignees

No one assigned

    Type

    Fields

    No fields configured for Bug.

    Projects

    Status
    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions