nugetvisual-studio-mac

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'

Solution

  • 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.

    If the NuGet package is not shown in the Add Packages dialog, after selecting the package source for your directory, try enabling "Show pre-release packages" via the checkbox.