NuGet / Home

Repo for NuGet Client issues

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nuget restore with --packages does not work as expected. The deprecated folder C:\Program Files\dotnet\sdk\NuGetFallBackFolder is still used silently.

ghoebenreich opened this issue · comments

NuGet Product Used

dotnet.exe

Product Version

6.0.420 [C:\Program Files\dotnet\sdk]

Worked before?

Never

Impact

It bothers me. A fix would be nice

Repro Steps & Context

I wanted to use the dotnet restore --package "packages" --force to restore all packages of my solution into the "packages" folder. No matter what I did I got different results on different computers.

Event after clearing the nuget cache with dotnet nuget locals all --clear i did not get the same number of restored packages.

I found out that the previous directory "C:\Program Files\dotnet\sdk\NuGetFallBackFolder" which was used prior to .NET 3.0 Core was still considered as cache. If the nuget package was already present in the C:\Program Files\dotnet\sdk\NuGetFallBackFolder the nuget package was not saved to the packages folder.

I would expect, using dotnet restore --force would take care of really considering all packages and store them, not only those which are in the official dotnet nuget cache lists.

I also would think that if something got removed and deprecated the C:\Program Files\dotnet\sdk\NuGetFallBackFolder is not of concern anyhow and should be ignored.

Verbose Logs

No response

Reading the spec for fallback packages folder, it looks like <clear/> tag is supported for that section of configuration. Can you please try adding the <clear /> tag as shown below and see if it works for your scenario?

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <fallbackPackageFolders>
     <clear />
  </fallbackPackageFolders>
</configuration>

This issue has been automatically marked as stale because we have not received a response in 14 days. It will be closed if no further activity occurs within another 14 days of this comment.