fsprojects / Paket

A dependency manager for .NET with support for NuGet packages and Git repositories.
https://fsprojects.github.io/Paket/
MIT License
2.02k stars 520 forks source link

System.IO.FileNotFoundException: Could not load file or assembly 'FSharp.Core, Version=6.0.0.0, #4178

Open inwenis opened 1 year ago

inwenis commented 1 year ago

Description

I'm trying to install FSharp.Data - causes my app to fail with

Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'FSharp.Core, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'FSharp.Core, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at <StartupCode$test3>.$Program.main@()

Repro steps

10-20 15:00:02 C:\git\new_pc> dotnet --version
6.0.401
10-20 15:00:11 C:\git\test3> dotnet new console -lang f#
...
10-20 15:00:24 C:\git\test3> dotnet run
Hello from F#
10-20 15:00:43 C:\git\test3> dotnet new tool-manifest
10-20 15:00:48 C:\git\test3> dotnet tool install paket
You can invoke the tool from this directory using the following commands: 'dotnet tool run paket' or 'dotnet paket'.
Tool 'paket' (version '7.1.5') was successfully installed. Entry is added to the manifest file C:\git\test3\.config\dotnet-tools.json.
10-20 15:00:52 C:\git\test3> dotnet paket add FSharp.Data -p .\test3.fsproj
Paket version 7.1.5+e2fe7c693356a5e70a74cc01501f7dc5f8996695
Adding package 'FSharp.Data'
Resolving dependency graph...
Updated packages:
  Group: Main
    - FSharp.Core: 6.0.6 (added)
    - FSharp.Data: 5.0.2 (added)
Created dependency graph (2 packages in total)
 - Project test3.fsproj needs to be restored
Resolved package 'FSharp.Data' to version 5.0.2
Calling dotnet restore on test3.fsproj
  Determining projects to restore...
  Paket version 7.1.5+e2fe7c693356a5e70a74cc01501f7dc5f8996695
  The last full restore is still up to date. Nothing left to do.
  Total time taken: 0 milliseconds
  Paket version 7.1.5+e2fe7c693356a5e70a74cc01501f7dc5f8996695
  Restoring C:\git\test3\test3.fsproj
  Starting restore process.
  Total time taken: 0 milliseconds
  Restored C:\git\test3\test3.fsproj (in 77 ms).
Total time taken: 1 second
10-20 15:01:27 C:\git\test3> dotnet run
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'FSharp.Core, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'FSharp.Core, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at <StartupCode$test3>.$Program.main@()

Expected behavior

It should just work and print "Hello from F#"

Actual behavior

Fails with

Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'FSharp.Core, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'FSharp.Core, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at <StartupCode$test3>.$Program.main@()

Known workarounds

....

thinkbeforecoding commented 1 year ago

This is something that happen when the paket.dependency contains framework restrictions that are not compatible with the nuget framework. Some packages are netstandard2.0 or netstandard2.1 only, and they are not integrated in the references if the restriction is net6.0 or net7.0 Could this be your problem?

ChrSteinert commented 10 months ago

Should be able to close after https://github.com/fsprojects/Paket/pull/4228