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

眉间皱痕 提交于 2019-12-10 14:44:31

问题


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'

回答1:


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.




回答2:


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" 


来源:https://stackoverflow.com/questions/48210166/how-to-install-local-nuget-package-nupkg-from-visual-studio-community-for-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!