According to yishaigalatzer (who, according to his Github profile, runs on Microsoft at Redmond): "This is done on purpose. Please do not add logic to get around this." (as part of the discussion of this question: https://github.com/NuGet/Home/issues/2623 )
So..
Here are some ways we can get around this. All this is intended so that "dotnet" does not try to connect to the server, but uses only the local package directory:
(1) Add the NuGet.config file as part of your project (in the same directory as project.json), which removes the online storage from sources. Use the following:
<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <clear /> </packageSources> </configuration>
(2) Use a custom NuGet configuration (for example, "MyCustomNuGet.config") that does not contain sources:
<?xml version="1.0" encoding="utf-8"?> <configuration> </configuration>
Then, when you run "dotnet recovery", explicitly specify to use your custom configuration file:
dotnet restore
(3) When starting โdotnet recoveryโ, explicitly specify the local directory of the package as the source:
dotnet restore -s $HOME/.nuget
(or where there may be a .nuget directory)
source share