NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 253 forks source link

dotnet add package <Project> --source <LocalDir> fails when offline #6353

Open livarcocc opened 6 years ago

livarcocc commented 6 years ago

From @lambdakris on December 22, 2017 2:46

Steps to reproduce

  1. ensure newtonsoft.json is in nuget global cache
  2. disconnect from internet
  3. dotnet add package Newtonsoft --source "$home/.nuget/packages"

Expected behavior

For dotnet/nuget to skip request to nuget.org and go directly to specified source

Actual behavior

PS C:\Users\lambdakris\Code\Hobby\Cafe\Cafe.Service> dotnet add package Newtonsoft.Json --source "$home/.nuget/packages"
  Writing C:\Users\lambdakris\AppData\Local\Temp\tmp2C91.tmp
info : Adding PackageReference for package 'Newtonsoft.Json' into project 'C:\Users\lambdakris\Code\Hobby\Cafe\Cafe.Service\Cafe.Service.fsproj'.
log  : Restoring packages for C:\Users\lambdakris\Code\Hobby\Cafe\Cafe.Service\Cafe.Service.fsproj...
info :   CACHE https://api.nuget.org/v3-flatcontainer/fsharp.core/index.json
info :   GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json
log  : Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json'.
log  : An error occurred while sending the request.
log  :   The server name or address could not be resolved
info :   GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json
log  : Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json'.
log  : An error occurred while sending the request.
log  :   The server name or address could not be resolved
info :   GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json
error: Failed to retrieve information about 'Newtonsoft.Json' from remote source 'https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json'.
error:   An error occurred while sending the request.
error:   The server name or address could not be resolved

Environment data

dotnet --info output:

PS C:\Users\lambdakris\Code\Hobby\Cafe\Cafe.Service> dotnet --info
.NET Command Line Tools (2.1.2)

Product Information:
 Version:            2.1.2
 Commit SHA-1 hash:  5695315371

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16299
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.2\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.3
  Build    : a9190d4a75f4a982ae4b4fa8d1a24526566c69df

Copied from original issue: dotnet/cli#8282

SommerEngineering commented 5 years ago

Is there any news on this? Does dotnet add package still not work when I am offline?