Visual Studio For Mac Add Nuget Package

Active6 months ago

Download Nuget Package Visual Studio

Visual Studio For Mac Add Nuget Package
  • Visual Studio for Mac 2017 - Can't add MVC nuget packages. I've created a new project using the ASPNET Core template in Visual Studio for Mac. I can run the default project fine, but when I add reference to 'Microsoft.AspNetCore.Mvc' or any of the other MVC related packages.
  • It seems like the only way to do it is to install the NuGet Package Manager Console. However, after downloading NuGet, I try to click on nuget.exe, and I get the message: You can’t open the application “nuget.exe” because Microsoft Windows applications are not supported on OS X.

If you are using Visual Studio for Mac 7.1 you will need a more recent NuGet Extensions version, which will add a dialog that you can use to manage packages at the solution level. The version currently published on the main Visual Studio for Mac addin server only works with Visual Studio for Mac 7.0.

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

Matt Ward
40k4 gold badges75 silver badges82 bronze badges
rraallvvrraallvv
1,4032 gold badges21 silver badges54 bronze badges

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.

Matt WardMatt Ward
40k4 gold badges75 silver badges82 bronze badges

Visual Studio For Mac

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:

Sudhanshu MishraSudhanshu Mishra
4,2442 gold badges39 silver badges60 bronze badges

Not the answer you're looking for? Browse other questions tagged nugetvisual-studio-mac or ask your own question.

Please complete the security check to access this website.

Why do I have to complete a CAPTCHA?

Completing the CAPTCHA proves you are a human and gives you temporary access to the web property.

What can I do to prevent this?

Visual Studio Code Add Nuget

If you are on a personal connection, like at home, you can run an anti-virus scan on your device to make sure it is not infected with malware.

If you are at an office or shared network, you can ask the network administrator to run a scan across the network looking for misconfigured or infected devices.