fsprojects / fsprojects/Paket

dotnet 3.1 always restores latest fsharp.core version

Open
#3,769 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

After upgrading from .net 3.0.100 to 3.1.100 it writes incorrect version of FSharp.Core to project.assets.json.
I have pinned FSharp.Core to 4.6 however it seems .net 3.1 tries to restore latest FSharp.Core 4.7

Repro steps

https://github.com/theimowski/net40_fsharp_core_3.1.2.5

Don't pay attention to repository name - initally I thought it was related to net40 and this old version of fsharp core, but found the issue is more generic

  1. dotnet build
Expected behavior

FSharp.Core version 4.6 in project.assets.json

Actual behavior

FSharp.Core 4.7 in project.assets.json

Known workarounds

I originally discovered this issue for net40 framework and old version of fsharp.core: 3.1.2.5, because for this mix dotnet build failed with a "Package FSharp.Core 4.7.0 is not compatible with net40" error:

> dotnet build
Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Paket version 5.241.5
  Starting full restore process.
  Performance:
   - Disk IO: 123 milliseconds
   - Runtime: 965 milliseconds
/Users/theimowski/sandbox/paket/net40_fsharp_core_3.1.2.5/net40_fsharp_core_3.1.2.5.fsproj : error NU1202: Package FSharp.Core 4.7.0 is not compatible with net40 (.NETFramework,Version=v4.0). Package FSharp.Core 4.7.0 supports:
/Users/theimowski/sandbox/paket/net40_fsharp_core_3.1.2.5/net40_fsharp_core_3.1.2.5.fsproj : error NU1202:   - net45 (.NETFramework,Version=v4.5)
/Users/theimowski/sandbox/paket/net40_fsharp_core_3.1.2.5/net40_fsharp_core_3.1.2.5.fsproj : error NU1202:   - netstandard2.0 (.NETStandard,Version=v2.0)
  Restore failed in 242.67 ms for /Users/theimowski/sandbox/paket/net40_fsharp_core_3.1.2.5/net40_fsharp_core_3.1.2.5.fsproj.

When I did dotnet paket restore before dotnet build the restore completed succesfully, but only for this net40 + fsharp.core 3.1.2.5 mix
The version written to project.assets.json was also correct:

> dotnet paket restore
Paket version 5.241.5
Starting full restore process.
Performance:
 - Disk IO: 121 milliseconds
 - Runtime: 871 milliseconds

> dotnet build
Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 217.41 ms for /Users/theimowski/sandbox/paket/net40_fsharp_core_3.1.2.5/net40_fsharp_core_3.1.2.5.fsproj.

Not sure what's happening here - tried to compare the files created by paket in obj directory but they seem to be identical in both cases...

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 with the linked reproduction repository and run dotnet build to compare the generated project.assets.json with the pinned FSharp.Core version. Compare the obj files produced by dotnet build and dotnet paket restore; done means the build respects FSharp.Core 4.6 and records that version in project.assets.json.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.