Open uladz-zubrycki opened 3 years ago
Just leaving this here in case somebody finds this issue and is facing the same cause that I did:
I had (because the dotnet paket init
created it like this) this in my paket.dependencies
:
source https://api.nuget.org/v3/index.json
storage: none
framework: netcoreapp3.1, netstandard2.0, netstandard2.1
Changing this to
source https://api.nuget.org/v3/index.json
storage: none
framework: auto-detect
made things work.
I'm just running into this very same issue and after being puzzled for a little while (I removed the FSharp.Core explicit references, but I kept having compile errors) I noticed this line in the .paket\Paket.Restore.targets
files:
<!-- Disable automagic references for F# DotNet SDK -->
<!-- This will not do anything for other project types -->
<!-- see https://github.com/fsharp/fslang-design/blob/master/tooling/FST-1002-fsharp-in-dotnet-sdk.md -->
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
This is probably because I created this project using the instructions of https://github.com/fsprojects/FSharp.TypeProviders.SDK/ (i.e. the "official" SDK for type providers), but those templates do not work well with VS 2022 (it just errors on loading the project). It also fixes the FSharp.Core version to 4.7-ish.
Removing it, only just lead to Paket putting it back. Not sure what's going on here or how to fix it... Sorry for blurring the thread with the comment, it's just in case someone has a solution or comes across the cause of this bug.
Description
If I create new FSharp project,
FSharp.Core
library is referenced implicitly unlessDisableImplicitFSharpCoreReference
is set totrue
, but it isn't by default. Look forFSCorePackageVersion
at\dotnet\sdk\5.0.101\FSharp\Microsoft.FSharp.NetSdk.props
for details.I will lose this reference by using paket for package restore after installing any package to the project.
Repro steps
Dotnet version: 5.0.101 Paket version: 5.257.0
Execute
dotnet new console -lang F# -n Repro
Execute
dotnet build
Reference toFSharp.Core
is there yet. Check out contents ofproject.assets
file in theobj
folder, you'll see"FSharp.Core/5.0.0"
under the"libraries"
node. Library is copied tobin
folder and is present as reference in the outputRepro.dll
.Execute
paket init
(Suppose that we have it globally)Add any package to the
.fsproj
file. Let it beNewtonSoft.Json
paket add NewtonSoft.Json
paket references
file containing the only line, which isNewtonSoft.Json
Execute
paket install
You'll seeF# project Repro\Repro.fsproj does not reference FSharp.Core.
Execute
dotnet build
FSharp.Core
reference is gone: it's not present inproject.assets
anymore, it's not present in the newly generatedRepro.fsproj.paket.props
, it's not copied to thebin
folder, but is still referenced by the generateddll
, though could not be found.Execute
dotnet run
You'll seeInstead of expected
Expected behavior
FSharp.Core
package is referenced and copied to thebin
folder.Actual behavior
FSharp.Core
is missing, causing runtime error.Known workarounds
Add
FSharp.Core
manually by runningpaket add FSharp.Core
and putting it to the project'spaket.references
file.