Cant find package manager console in visual studio

2020-06-09 03:45发布

问题:

I am using Visual studio for mac. I need to install some packages but I can't find package manager console for that.

Visual studio version: Preview 1 (7.0 build 347)

回答1:

Similar to Xamarin Studio, you have to use its dialog,

https://developer.xamarin.com/guides/cross-platform/xamarin-studio/nuget_walkthrough/

As there was no cross platform PowerShell, Xamarin Studio lacks of Package Manager Console. It might come one day in Visual Studio for Mac. We will see.



回答2:

Warning:

A commenter reports this extension crashes VS Community 2019 for Mac version 8.5 (Build 3183). I haven't upgraded to it, so I can't speak to this. Anyone with information/fix/alternate approach, please chime in down in the comments.

OK:

At least in Visual Studio Community 8.4.8 build 2, you can find it under Visual Studio-->Extensions, using search term "nuget":

It took me so long to find this I hope it helps someone else find it faster!



回答3:

You can follow the NuGet CLI reference and install it https://docs.microsoft.com/en-us/nuget/tools/nuget-exe-cli-reference

An excerpt from that link provided reads:

macOS/Linux

Behaviors may vary slightly by OS distribution.

  1. Install Mono 4.4.2 or later.

  2. Execute the following commands at a shell prompt:

    # Download the latest stable `nuget.exe` to `/usr/local/bin`
    sudo curl -o /usr/local/bin/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
    # Give the file permissions to execute
    sudo chmod 755 /usr/local/bin/nuget.exe 
    
  3. Create an alias by adding the following script to the appropriate file for your OS (typically ~/.bash_aliases or ~/.bash_profile):

    # Create as alias for nuget
    alias nuget="mono /usr/local/bin/nuget.exe" 
    
  4. Reload the shell. Test the installation by entering nuget with no parameters. NuGet CLI help should display.



回答4:

I found a good reference for mac users:

https://github.com/mrward/monodevelop-nuget-extensions

Thanks for the reference and it works for me.