CollectPackageReferences in .NET Core 2.0.2 results in Paket failing to restore the dotnet-fable tool in fable-suave-scaffold
See original GitHub issueDescription
From @rrelyea in our internal investigation thread:
CollectPackageReferences
was implemented by VS/ProjectSystem in 15.0.
They asked NuGet commandline to start respecting it, as a hook for customer scenarios (including paket).
For the 15.4 timeframe, we’ve added that support.
In .NET Core 2.0.0 – Paket downloaded many nupkgs and put them in the user package folder. However, they just put the .nupkg there, they didn’t extract it. It still worked because NuGet redownloaded all the packages and cleaned up their non-extracted install.
In .NET Core 2.0.2 – NuGet now is respecting CollectPackageReferences, which enables Paket to clear NuGet sources via the nuget.config that they pass us. This means we cannot go download things the 2nd time to make it all work.
This looks like the correct behavior from NuGet.
Paket is trying to prevent NuGet from downloading twice, despite the fact that they downloaded them improperly the first time.
Repro steps
On Windows (I haven’t tested this on macOS or Linux)
-
Install .NET Core 2.0.2
-
Clone fable-suave-scaffold
-
Instal Node LTS and Yarn latest
-
Run
build.cmd
Expected behavior
Success.
Actual behavior
Failure (paths are from a test VM, but this will repro on a local machine).
C:\Users\ddltd1\Documents\fable-suave-scaffold-master\src\Client\Client.fsproj : error NU1100: Unable to resolve 'dotnet-fable (>= 1.2.2)' for '.NETCoreApp,Version=v2.0'.
C:\Program Files\dotnet\sdk\2.0.2-vspre-006963\NuGet.targets(102,5): error : Value cannot be null.\r [C:\Users\ddltd1\Documents\fable-suave-scaffold-master\src\Client\Client.fsproj]
C:\Program Files\dotnet\sdk\2.0.2-vspre-006963\NuGet.targets(102,5): error : Parameter name: path [C:\Users\ddltd1\Documents\fable-suave-scaffold-master\src\Client\Client.fsproj]
Running build failed.
Error:
System.Exception: dotnet restore failed
at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1379.Invoke(String message)
at FSI_0005.Build.runDotnet(String workingDir, String args)
at FSI_0005.Build.clo@137-11.Invoke(Unit _arg9)
at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in D:\code\FAKE\src\app\FakeLib\TargetHelper.fs:line 626
Impact
This will impact fable-suave-scaffold on .NET Core moving forward. The first time people could encounter this en-masse will be when VS 2017 15.4 releases.
Known workarounds
Use 2.0.0 first, then switch back to 2.0.2.
Relevant info
https://github.com/NuGet/Home/issues/4967 https://github.com/dotnet/project-system/issues/653
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:10 (7 by maintainers)
Top GitHub Comments
this is fixed in paket 5.98 in order to test it you need to nuke the
paket-files
folder inside the project so that paket restores again. Thanks again for reporting.I still think the NuGet team should try to improve the error message.
I’ve recently ran into this issue out of nowhere. I am using paket 5.184.0 and somehow things got broken with the
error NU1100
.What worked for me was the following:
.paket/paket.exe clear-cache
(in case of an error, run multiple times until no error)rm -rf obj/
(especially if you use the .NET SDK and/or are targetting netstandard/netcore)rm -rf paket-files/
rm -rf packages/
.paket/paket.exe update
dotnet restore [YourProjectHere]
- if you use the dotnet sdk