Home > Net >  How does implicit FSharp.Core reference work in an fsproj?
How does implicit FSharp.Core reference work in an fsproj?

Time:09-01

Months ago I had build a Windows app using a mix of C# and F# projects. The C# project uses FSharp.Core 5.0.0. I had not noticed this until today, but the .fsproj does not specify a version of FSharp.Core. This hasn't been an issue and successfully builds on my local machine using Visual Studio 2019 (all projects are using 5.0.0).

Today, a colleague of mine cloned the repo and tried building the project, only to get a build error for a detected package downgrade of FSharp.Core from 6.0.5 to 5.0.0. My colleague uses Visual Studio 2022 and noticed while the C# project was using FSharp.Core 5.0.0 (as explicitly specified in the .csproj), the F# projects were using 6.0.5.

I've done a bit of reading with what I could find for FSharp.Core implicit references, but don't really understand how the version is selected or how to remedy this situation.

How does Visual Studio figure out which version of FSharp.Core it wants to use for FSharp projects and how can I insure uniform behavior on different machines and versions of Visual Studio.

CodePudding user response:

FSharp.Core is defined in the F# targets loaded by build tooling. It's pinned to the latest released version for the .NET SDK you're using.

You can ready here about using it with C# projects: https://github.com/dotnet/fsharp/blob/main/docs/fsharp-core-notes.md#c-projects-referencing-f-projects-may-need-to-pin-fsharpcore

  • Related