Dominique
Dominique

Reputation: 17493

Newbie: how to restore nuget packages?

I've downloaded a C# project, based on NuGet packages, but I fail to restore them. Here you see what happens when I ask for restoring those packages: (in top of this, the "Autenticator" app on my smartphone constantly asks me for permission (which I'm giving, of course).

Hereby the results of a NuGet restore in commandline (just for one particular package, there are lots of them:

C:\<Project_Dir>>nuget restore
MSBuild auto-detection: using msbuild version '16.10.2.30804' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\bin'.
Restoring NuGet package Own_Product.Client.Core.1.52.1961.
...
  GET https://api.nuget.org/v3-flatcontainer/Own_Product.client.core/1.52.1961/Own_Product.client.core.1.52.1961.nupkg
...
  NotFound https://api.nuget.org/v3-flatcontainer/Own_Product.client.core/1.52.1961/Own_Product.client.core.1.52.1961.nupkg 459ms
...
  GET https://Own_Product.pkgs.visualstudio.com/_packaging/Own_ProductNuGetFeed/nuget/v2/Packages(Id='Own_Product.Client.Core',Version='1.52.1961')
...
  NotFound https://Own_Product.pkgs.visualstudio.com/_packaging/Own_ProductNuGetFeed/nuget/v2/Packages(Id='Own_Product.Client.Core',Version='1.52.1961') 1252ms
  GET https://Own_Product.pkgs.visualstudio.com/_packaging/Own_ProductNuGetFeed/nuget/v2/FindPackagesById()?id='Own_Product.Client.Core'&semVerLevel=2.0.0
...
  OK https://Own_Product.pkgs.visualstudio.com/_packaging/Own_ProductNuGetFeed/nuget/v2/FindPackagesById()?id='Own_Product.Client.Core'&semVerLevel=2.0.0 422ms
...
WARNING: Unable to find version '1.52.1961' of package 'Own_Product.Client.Core'.
  C:\Users\this_User\.nuget\packages\: Package 'Own_Product.Client.Core.1.52.1961' is not found on source 'C:\Users\this_User\.nuget\packages\'.
  C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Own_Product.Client.Core.1.52.1961' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
  https://api.nuget.org/v3/index.json: Package 'Own_Product.Client.Core.1.52.1961' is not found on source 'https://api.nuget.org/v3/index.json'.
  https://Own_Product.pkgs.visualstudio.com/_packaging/Own_ProductNuGetFeed/nuget/v2: Package 'Own_Product.Client.Core.1.52.1961' is not found on source 'https://Own_Product.pkgs.visualstudio.com/_packaging/Own_ProductNuGetFeed/nuget/v2'.
...
WARNING: Unable to find version '1.52.1961' of package 'Own_Product.Client.Core'.
  C:\Users\this_User\.nuget\packages\: Package 'Own_Product.Client.Core.1.52.1961' is not found on source 'C:\Users\this_User\.nuget\packages\'.
  C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Own_Product.Client.Core.1.52.1961' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
  https://api.nuget.org/v3/index.json: Package 'Own_Product.Client.Core.1.52.1961' is not found on source 'https://api.nuget.org/v3/index.json'.
  https://Own_Product.pkgs.visualstudio.com/_packaging/Own_ProductNuGetFeed/nuget/v2: Package 'Own_Product.Client.Core.1.52.1961' is not found on source 'https://Own_Product.pkgs.visualstudio.com/_packaging/Own_ProductNuGetFeed/nuget/v2'.
...

For your information:

  1. I'm using NuGet.exe version 5.9.1.11, instead of the standard 2.8.50126.400 one.

  2. The result of Nuget list Own_Product.client.core gives another version than the one I'm seem to be looking for while doing the regular compilation:

     C:\<Project_Dir>>nuget list Own_Product.client.core
     nuget list Own_Product.client.core
     MSBuild auto-detection: using msbuild version '16.10.2.30804' from 
       'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\bin'.
     Own_Product.Client.Core 20.3.18.1
    

Upvotes: 0

Views: 600

Answers (1)

JonasH
JonasH

Reputation: 36341

Since you mention that this is for an internal repository it is likely that you are missing the package source for your internal repo. This is specified in the %AppData%\NuGet\NuGet.config file, and is easiest to edit thru the visual studio package sources dialog

Looking at the error it seems like nuget is looking for the package at api.nuget.org and Own_Product.pkgs.visualstudio.com. The later does not seem look like a real repository for visual studio, so it might be miss-configured.

Since it is an internal repo it is difficult say what the exact settings should be, I would suggest you ask a college to send a copy of the settings they use.

Upvotes: 2

Related Questions