question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CollectPackageReferences in .NET Core 2.0.2 results in Paket failing to restore the dotnet-fable tool in fable-suave-scaffold

See original GitHub issue

Description

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)

  1. Install .NET Core 2.0.2

  2. Clone fable-suave-scaffold

  3. Instal Node LTS and Yarn latest

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

cc @emgarten and @davkean as well.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
forkicommented, Sep 21, 2017

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.

0reactions
ivaylo5evcommented, Nov 3, 2018

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
Read more comments on GitHub >

github_iconTop Results From Across the Web

Package Restore Failed / .Net Core Install Bug
Tools -> NuGet Package Manager -> Package Manager Console · Select required project to restore packages from 'Default Project' list · Run the ......
Read more >
Troubleshooting NuGet Package Restore in Visual Studio
This article focuses on common errors when restoring packages and steps to resolve them. Package Restore tries to install all package ...
Read more >
NuGet Package Restore
See an overview of how NuGet restores packages a project depends on, including how to disable restore and constrain versions.
Read more >
Paket and the .NET SDK / .NET Core CLI tools (dotnet CLI ...
references files files have been created, run dotnet restore (see restoring packages) to update your projects. In contrast to traditional .NET projects Paket...
Read more >
Why isn't my ASP.NET Core app in Docker working?
In this post I describe a problem where my ASP.NET Core app in Docker wasn't responding to requests. This post debugs and diagnoses...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found