Package Manager console (Visual Studio, Tools > NuGet Package Manager > Package Manager Console): Run the Update-Package -reinstall -ProjectName command where is the name of the affected project as it appears in Solution Explorer. Use Update-Package -reinstall by itself to restore. Adding and updating NuGet packages via command line – dotnet CLI. Just like we can add, remove and update NuGet packages via UI in Visual Studio or Visual Studio Code we can accomplish the same using the dotnet CLI.
![Visual Visual](https://doc.postsharp.net/asset?path=media/uninstall14.png&etag=7eb5520b)
Installing NuGet client tools. 5 minutes to read.
Contributors. In this article Looking to install a package? To work with NuGet, as a package consumer or creator, you can use as well as. This article briefly outlines the capabilities of the different tools, how to install them, and their comparative. To get started using NuGet to consume packages, see. To get started creating NuGet packages, see. Tool Description Download Included with the.NET Core SDK and provides core NuGet features on all platforms.
Provides all NuGet capabilities on Windows, provides most features on Mac and Linux when running under Mono. On Windows, provides NuGet capabilities through the Package Manager UI and Package Manager Console; included with.NET-related workloads. On Mac, provides certain features through the UI. In Visual Studio Code, NuGet features are provided through extensions. The also provides the ability to restore and create packages, which is primarily useful on build servers. MSBuild is not a general-purpose tool for working with NuGet. CLI tools The two NuGet CLI tools are dotnet.exe and nuget.exe.
See for a comparison. Dotnet.exe CLI The.NET Core 2.0 CLI, dotnet.exe, works on all platforms (Windows, Mac, and Linux) and provides core NuGet features such as installing, restoring, and publishing packages. Dotnet provides direct integration with.NET Core project files (such as.csproj), which is helpful in most scenarios. Dotnet is also built directly for each platform and does not require you to install Mono. Installation:. On developer computers, install the. For build servers, follow the instructions on.
For more information, see. Nuget.exe CLI The NuGet CLI, nuget.exe, is the command-line utility for Windows that provides all NuGet capabilities; it can also be run on Mac OSX and Linux using with some limitations.
Unlike dotnet, the nuget.exe CLI does not affect project files and does not update packages.config when installing packages. Installation: Windows. Visit and select NuGet 3.3 or higher (2.8.6 is not compatible with Mono).
The latest version is always recommended, and 4.1.0+ is required to publish packages to nuget.org. Each download is the nuget.exe file directly. Instruct your browser to save the file to a folder of your choice. The file is not an installer; you won't see anything if you run it directly from the browser. Add the folder where you placed nuget.exe to your PATH environment variable to use the CLI tool from anywhere. MacOS/Linux Behaviors may vary slightly by OS distribution.
Execute the following command at a shell prompt: # Download the latest stable `nuget.exe` to `/usr/local/bin` sudo curl -o /usr/local/bin/nuget.exe. Create an alias by adding the following script to the appropriate file for your OS (typically /.bashaliases or /.bashprofile): # Create as alias for nuget alias nuget='mono /usr/local/bin/nuget.exe'. Reload the shell. Test the installation by entering nuget with no parameters. NuGet CLI help should display. Note The latest recommended NuGet CLI is always available at For compatibility purposes with older continuous integration systems, a previous URL, currently provides the.
Visual Studio. Visual Studio Code: NuGet capabilities are available through marketplace extensions, or use the dotnet.exe or nuget.exe CLI tools. Visual Studio for Mac: certain NuGet capabilities are built in directly. See for a walkthrough.
For other capabilities, use the dotnet.exe or nuget.exe CLI tools. Visual Studio on Windows: The NuGet Package Manager is included with Visual Studio 2012 and later. The Package Manager provides the and the, through which you can run most NuGet operations.
The Visual Studio 2017 installer includes the NuGet Package Manager with any workload that employs.NET. To install separately, or to verify that the Package Manager is installed, run the Visual Studio 2017 installer and check the option under Individual Components Code tools NuGet package manager. The Package Manager UI and Console are unique to Visual Studio on Windows. They are not presently available on Visual Studio for Mac. Visual Studio does not automatically include the nuget.exe CLI, which must be installed separately as described earlier. Package Manager Console commands work only within Visual Studio on Windows and do not work within other PowerShell environments. For Visual Studio 2010 and earlier, install the 'NuGet Package Manager for Visual Studio' extension.
NuGet Extensions for Visual Studio 2013 and 2015 can also be downloaded from. If you'd like to preview upcoming NuGet features, install the, which works side-by-side with stable releases of Visual Studio. To report problems or share ideas for previews, open an issue on the. Feature availability Feature dotnet CLI nuget CLI (Windows) nuget CLI (Mono) Visual Studio (Windows) Visual Studio for Mac Search packages ✔ ✔ ✔ ✔ Install/uninstall packages ✔ ✔(1) ✔ ✔ ✔ Update packages ✔ ✔ ✔ ✔ Restore packages ✔ ✔ ✔(2) ✔ ✔ Manage package feeds (sources) ✔ ✔ ✔ ✔ Manage packages on a feed ✔ ✔ ✔ Set API keys for feeds ✔ ✔ Create packages(3) ✔ ✔ ✔(4) ✔ Publish packages ✔ ✔ ✔ ✔ Replicate packages ✔ ✔ Manage global-package and cache folders ✔ ✔ ✔ Manage NuGet configuration ✔ ✔ (1) Does not affect project files; use dotnet.exe instead.
(2) Works only with packages.config file and not with solution (.sln) files. (3) Various advanced package features are available through the CLI only as they aren't represented in the Visual Studio UI tools. (4) Works with.nuspec files but not with project files. Related topics.
Developers working on Windows can also explore the, an open-source, stand-alone tool to visually explore, create, and edit NuGet packages. It's very helpful, for example, to make experimental changes to a package structure without rebuilding the package.
Adding and updating NuGet packages via command line – dotnet CLI Just like we can add, remove and update NuGet packages via UI in Visual Studio or Visual Studio Code we can accomplish the same using the dotnet CLI. Adding package For example, to add ASP.NET Core CORS package we run the following: dotnet add package Microsoft.AspNetCore.Mvc.Cors Adding package from specific source/feed However, if we wanna use another NuGet source like MyGet and lets say we wanna install SignalR we do this: dotnet add package Microsoft.AspNetCore.SignalR -s Update package How do we update a package? We install a specific version of the package.
![Visual Studio For Mac Remove Nuget Package Visual Studio For Mac Remove Nuget Package](/uploads/1/2/5/6/125629752/633195006.png)
To install a specific version SignalR from same ASP.NET Core CI dev source: dotnet add package Microsoft.AspNetCore.SignalR -s -v 1.0.0-preview3-26035 Remove package dotnet-remove package Microsoft.AspNetCore.SignalR Adding source to NuGet Adding a source to NuGet: nuget sources Add -Name 'ASP.NET Core CI dev' -Source You could also manually add sources by changing NuGet.Config file. Mac /.config/NuGet/NuGet.Config. Windows%AppData% NuGet NuGet.Config.
Linux /.config/NuGet/NuGet.Config.