Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Offline Nuget Packages

I need to install Nuget Package ProductionStackTrace, so I use the following command

PM> Install-Package ProductionStackTrace

But when I execute this command I get the following error

The source at Microsoft Visual Studio Offline Packages [C:\Program Files (x86)\Microsoft SDKs\NuGetPackages] is unreachable.

I checked the path and yes the package is not there; isn't Nuget Package added by default? If not, from where I can add it?

like image 931
tulipe Avatar asked Mar 14 '17 12:03

tulipe


2 Answers

Visual Studio provides some common packages for us to use in the Microsoft SDKs\NuGetPackages folder when our computer doesn't have network.

The C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\ folder is not means that the cache for the packages has been installed before from internet. So the package ProductionStackTrace will not add into this folder.

If you want to use this package without network, you need to download it when you have network. You can download it from the nuget.org.

Certainly, you can also add this package in to the Microsoft SDKs\NuGetPackages so that you can use it when you do not have a network. The add command line is:

nuget add <packagePath> -source <sourcePath> [options]

You can refer to the nuget Add reference for detail.

Hope this can help you.

like image 178
Leo Liu-MSFT Avatar answered Oct 29 '22 09:10

Leo Liu-MSFT


for Visual Studio Mac, packages are copied into the path /Users/{username}/.nuget/packages

You can choose menu for Visual Studio->Preferences->Nuget->Sources and add a new source using this path and install already cached packages.

like image 22
Emil Avatar answered Oct 29 '22 08:10

Emil