Paket
Paket copied to clipboard
Default dependencies refer to net5.0 framework
Description
Initializing a new F# project and using paket breaks the project.
Repro steps
Make sure that .net6 or .net7 are installed.
- create a new project with
dotnet new console -lang F#
- install paket
- add any dependency, e.g.
dotnet paket add FSharp.Core
-
dotnet run
Expected behavior
We see the Hello from F#!
output
Actual behavior
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'FSharp.Core, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'FSharp.Core, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Known workarounds
Make sure that the .fsproj
and paket.dependencies
files agree on the framework.
For example use framework: auto-detect
in the paket.dependencies
file.
I would suggest changing the default template that is crated with paket init
to auto-detect
. This seems to me to be the easiest, and most beginner-friendly way.
I located, what I think, are the relevant lines of code. In the Environment.fs
file at the very bottom
let init (directory : DirectoryInfo) =
let sources = [PackageSources.DefaultNuGetV3Source]
let additionalLines = [
"storage: none"
"framework: net5.0, netstandard2.0, netstandard2.1"
]
initWithContent sources additionalLines directory
But maybe there is a good reason, which I don't know, for not using auto-detect
as the default.
I guess this can be closed with the latest version?