How do I Update a Nuget Package using dotnet CLI

The current version of the dotnet command line interface provides features to add a nuget package, but doesn’t expose a separate command to update them. However, you can actually achieve this by simply running the dotnet add package command, for example:

dotnet add package Microsoft.AspNetCore

If you don’t provide a version flag, this will default to upgrading to the latest version. To specify a version, add the -v parameter:

dotnet add package Microsoft.AspNetCore -v 1.0.2

Here you can see a sample project with an older version of AspNetCore shown in Visual Studio’s Nuget Package Manager:

Run the command in Powershell:

The result is the updated version in the project.

Currently there isn’t a command to browse, search, or list packages from the dotnet CLI. However, this is coming in version 2.0.

If you liked this post, consider subscribing to email updates about my new posts, or sharing it on Hacker News.

Keyboard shortcuts

?
Show this help
Esc
Close this help or an open menu
n
Next (newer) post: How to remove untracked local files from git working tree?
p
Previous (older) post: Should I Use WebListener or Kestrel or IIS on Windows?
Tab
Move between links and buttons (Shift+Tab to go back)