Fable.Core have an implicit dependency on FSharp.Core 9
When using net48, Fable.Core has an implicit dependency on FSharp.Core 9.
This triggers warning MSB3277 during build:
warning MSB3277: Found conflicts between different versions of "FSharp.Core" that could not be resolved. [C:\git\fable-core-test\fablecore-fsharpcore-conflict\test-fablecore-fsharpcore\test-fablecore-fsharpcore.fsproj::TargetFramework=net48]
warning MSB3277: There was a conflict between "FSharp.Core, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "FSharp.Core, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". [C:\git\fable-core-test\fablecore-fsharpcore-conflict\test-fablecore-fsharpcore\test-fablecore-fsharpcore.fsproj::TargetFramework=net48]
...
I have created a project that reproduces the issue (https://github.com/PierreYvesR/fablecore-fsharpcore-conflict).
This PR sets DisableImplicitFSharpCoreReference to false, this pins FSharp.Core to 4.7.2 (as referenced in Fable.Core.fsproj)
(see https://github.com/dotnet/fsharp/blob/main/docs/fsharp-core-notes.md#package-authors-should-pin-their-fsharpcore-reference).
Before:
Fable.Corenuget package does not have a dependency on `FSharp.CoreFable.Core.dll's manifest referencesFSharp.Core9.0.0 (see below)
After:
Fable.Corenuget package depends onFSharp.Core4.7.2Fable.Core.dll's manifest referencesFSharp.Core4.7.2
The current Fable.Core.dll's manifest in ildasm:
// Metadata version: v4.0.30319
.assembly extern netstandard
{
.publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) // .{...-.Q
.ver 2:0:0:0
}
.assembly extern FSharp.Core
{
.publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....:
.ver 9:0:0:0
}
Wth DisableImplicitFSharpCoreReference set to false:
// Metadata version: v4.0.30319
.assembly extern netstandard
{
.publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) // .{...-.Q
.ver 2:0:0:0
}
.assembly extern FSharp.Core
{
.publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....:
.ver 4:7:0:0
}
I'm not sure the "FSharp.Core" Version="4.7.2" dependency should be there either.
I am wondering why we are seing this issue now, it has been like that for a long time.
This PR sets
DisableImplicitFSharpCoreReferenceto false, this pinsFSharp.Coreto 4.7.2 (as referenced inFable.Core.fsproj)
For having to deal with FSharp.Core dependencies across different projects, sometimes you wants to pin it and sometimes you don't...
I think the idea with not having an official dependency against FSharp.Core was to let people bring the version they want FSharp.Core is binary compatible between versions.
I'm not sure the
"FSharp.Core" Version="4.7.2"dependency should be there either.
Having a dependency on version 4.7.2 should be "okay" however, it seems if we by mistakes update this line
https://github.com/fable-compiler/Fable/blob/d6733365b08b380c8d5a97c28a719f7ffa3ab84b/src/Fable.Core/Fable.Core.fsproj#L26
Then the changes will need to be cascaded across all the ecosystem.
I am wondering why we are seing this issue now, it has been like that for a long time.
I've had similar problems for a little while but I was never able to understand why, so everytime I ended up upgrading my FSharp.Core dependency.
I also think it's not that frequent to target net48 while referencing Fable.Core. There are no such problem if targeting netstandard2.0/net6 or higher.
Looking at old nuget packages It seems that it changed from 3.4.0 to 3.6.0:
3.4.0 had a nuget dependency on FSharp.Core 4.7.0.
Since 3.6.0, there is no nuget dependency, but looking at the manifest of the .dll file itself:
- 3.6.0's dll references
FSharp.Core 6.0.0 - 4.1.0 references
FSharp.Core 6.0.0 - 4.2.0 and 4.3.0 reference
FSharp.Core 8.0.0 - 4.4.0 and 4.5.0 reference
FSharp.Core 9.0.0(which seems to line up with the version of the SDK used to build Fable.Core)
@PierreYvesR Thanks for the clarification.
It strange that even when we ask to not have dependencies against something, there still are some reference to it and have it updating...
Because, of that it is probably better to make Fable.Core depends on the lowest version of FSharp.Core possible (in this case we will keep 4.7.2.
My main concerns is regarding the support of newer APIs hopefully we can support them without changing the FSharp.Core version. But because Fable.Core is mostly related to bindings or Fable specific APIs I think this should be ok.
I will merge this PR later if there are no more concerns about it.