Manage Packages with NuGet CLI

  • 2 minutes to read

The NuGet CLI is a command line tool that allows you to install, create, publish, and manage NuGet packages.

Add DevExpress NuGet Packages to a Project

You can use a feed authorization key or NuGet feed URL to add NuGet packages to your project. For more information on these approaches, refer to the sections below.

Feed Authorization Key

The following command installs a package into the current project. Specify the credentials to complete the installation:

  • Username: DevExpress
  • Password: specify your feed authorization key
> nuget install DevExtreme.AspNet.Core -Source https://nuget.devexpress.com/api -Source https://api.nuget.org/v3/index.json
Feeds used:
  https://nuget.devexpress.com/api
  https://api.nuget.org/v3/index.json

Installing package 'DevExtreme.AspNet.Core' to '\WebApplication5'.
  GET https://api.nuget.org/v3/registration5-gz-semver2/devextreme.aspnet.core/index.json
  GET https://nuget.devexpress.com/api/FindPackagesById()?id='DevExtreme.AspNet.Core'&semVerLevel=2.0.0
MSBuild auto-detection: using msbuild version '16.9.0.11203' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin'.
  OK https://api.nuget.org/v3/registration5-gz-semver2/devextreme.aspnet.core/index.json 504ms
Please provide credentials for: https://nuget.devexpress.com/api
UserName: DevExpress
Password: {your-feed-authorization-key}

NuGet Feed URL

This approach uses a NuGet feed URL to specify the package source for installed NuGet packages.

# Add DevExtreme.AspNet.Core to the current project
nuget install DevExtreme.AspNet.Core -Source https://nuget.devexpress.com/{your-feed-authorization-key}/api -Source https://api.nuget.org/v3/index.json

Common Commands

The sample below illustrates different console inputs that allow you to manage NuGet packages.

# Update all packages in the project
# You can omit the `{your-feed-authorization-key}` URL part, if you have your credentials saved in Windows Credentials 
# **Control Panel** → **User Accounts** → **Credential Manager** → **Windows Credentials**
nuget update -Source https://nuget.devexpress.com/{your-feed-authorization-key}/api -Source https://api.nuget.org/v3/index.json

# Update the DevExtreme.AspNet.Core package
nuget update -Id DevExtreme.AspNet.Core -Source https://nuget.devexpress.com/{your-feed-authorization-key}/api -Source https://api.nuget.org/v3/index.json

# Remove the DevExtreme.AspNet.Core package
nuget delete DevExtreme.AspNet.Core

# Install missing packages
dotnet restore -s https://nuget.devexpress.com/{your-feed-authorization-key}/api -s https://api.nuget.org/v3/index.json

Refer to Microsoft documentation for more information on NuGet CLI and its commands: NuGet CLI Reference.