Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install local NuGet package (.nupkg) from Visual Studio Community for Mac?

I've created a package with nugget CLI but can't find a way to install it from the IDE, the Package Manager Console isn't available in the version for Mac, and the nuget CLI tries to retrieve the package from the internet instead of reading the .nupkg file.

I have VS Community for Mac 7.3.3, mono 5.4.1.7 and nuget 4.3.0.4406

This is what I get when trying to install from the CLI

$ nuget install Package.1.0.0.nupkg 
Feeds used:
  https://api.nuget.org/v3/index.json

  GET https://api.nuget.org/v3/registration3-gz-semver2/package.1.0.0.nupkg/index.json
  NotFound https://api.nuget.org/v3/registration3-gz-semver2/package.1.0.0.nupkg/index.json 363ms
Unable to find package 'Package.1.0.0.nupkg'
like image 227
rraallvv Avatar asked Jan 11 '18 15:01

rraallvv


2 Answers

You can add the directory that contains the .nupkg file as a package source in Visual Studio for Mac.

  1. Select Preferences from the main menu.
  2. Open NuGet - Sources in the Preferences dialog.
  3. Click the Add button.
  4. In the Add Package Source dialog that opens click the Browse button.
  5. Find the directory with your .nupkg file then click the Open button.
  6. Change the Name of the package source if you want to.
  7. Then click the Add Source button.

Then you should be able to select the package source for your directory in the Add Packages dialog.

like image 140
Matt Ward Avatar answered Sep 22 '22 15:09

Matt Ward


I understand this is an answered question but for the sake of completeness, I'll add my 2 cents. Since the original question talks about nuget CLI, one can use the CLI to add a package source like so:

nuget sources Add -Name "Feed Name" -Source "/path/to/directory" 
like image 29
Sudhanshu Mishra Avatar answered Sep 23 '22 15:09

Sudhanshu Mishra