Skip to content

dotnet 3.1 always restores latest fsharp.core version #3769

@theimowski

Description

@theimowski

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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions