Share via


Installing NuGet packages manually?

Question

Friday, December 8, 2017 7:15 PM

I'm trying to install ValueTuple nuget package manually without internet connection:

https://www.nuget.org/packages/System.ValueTuple/

But getting an error:

Install-Package System.ValueTuple -Source N:\
 
 
Attempting to gather dependency information for package 'System.ValueTuple.4.4.0' with respect to project 'Advent7', targeting '.NETFramework,Version=v4.6.1'
Install-Package : Exception 'System.AggregateException' thrown when trying to add source 'https://api.nuget.org/v3/index.json'. Please verify all your online package sources are available.
  One or more errors occurred.
  Unable to load the service index for source https://api.nuget.org/v3/index.json.
  An error occurred while sending the request.
  Unable to connect to the remote server
  An attempt was made to access a socket in a way forbidden by its access permissions 93.184.221.200:443
At line:1 char:16
+ Install-Package <<<<  System.ValueTuple -Source N:\
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Apparently it still wants to connect. How can I avoid that? My project targets .NET Framework 4.6.1 so it should be good on dependencies.

All replies (1)

Monday, December 11, 2017 6:53 AM ✅Answered

Hi,

Please make sure that you have created a local nuget repository for offline development.

  • Firstly, you’ll need to create a local folder to house all your local NuGet packages.
  • The next step is to download the NuGet packages you wish to be able to use offline into this folder.(need network connection)
  • Once you have successfully downloaded the .nupkg files you require into your local repository folder, head into Visual Studio and open the NuGet Settings dialog via Tools > NuGet Package Manager > Package Manager Settings. Click the Package Sources tab within the settings dialog, followed by the ‘plus’ icon in the top left to add a new package source.
  • Now that you have added the local package source, you will be able to use your offline local repository from within Visual Studio in the usual way.

refer: Creating a local NuGet repository for offline development

(Note: This response contains a reference to a third-party World Wide Web site. Microsoft is providing this information as a convenience to you. 
Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.)

Best regards,

Joyce

Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected].