fsprojects / fsprojects/Paket

Default dependencies refer to net5.0 framework

Open
#4,186 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
F#
Stars
2.1k
Forks
528
Avg merge
1d 12m
Merged PRs (30d)
54

Description

Description

Initializing a new F# project and using paket breaks the project.

Repro steps

Make sure that .net6 or .net7 are installed.

  1. create a new project with dotnet new console -lang F#
  2. install paket
  3. add any dependency, e.g. dotnet paket add FSharp.Core
  4. 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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Environment.fs at the init function and reproduce the failure with the listed dotnet and Paket commands. Check how paket init generates paket.dependencies, then confirm the default framework setting is compatible with the new project's target and that dotnet run produces the expected Hello from F#! output.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
cli, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.