dotnet / dotnet/fsharp

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

Open
#20,038 0 comments 0 reactions 0 assignees View on GitHub
Bug Needs-Triage
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 22h
Merged PRs (30d)
144

Description

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 '.$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//Data/FSharp/Projects/MBUtilities/Publish/FSharp.Core.dll'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)
File name: '/home//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 .$MBUtilities.CrossPlatform..cctor() in /home//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 .$FSI_0001.main@() in /home//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
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with `dotnet fsi testing-fsharp-core-issue.fsx` using the SDK versions and publish directory described in the issue. Trace how F# Interactive resolves `FSharp.Core` and verify the fix by running the script without an assembly version error while preserving normal library publishing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.