Skip to main content

Install NuGet Packages with Command Line Interface (CLI) Tools

  • 3 minutes to read

Note

NuGet package sources are affectively combined from different locations. To learn how to add the DevExpress package source to a particular location, refer to Common NuGet configurations.

You can use console tools - .NET CLI and NuGet CLI - to manage project dependencies. Sections below demonstrate how you can add or remove NuGet packages and execute miscellaneous operations.

.NET CLI: 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.

Use Feed Authorization Key

The first approach uses the following information for authorization:

  • Username: use the -u option and specify DevExpress as the option value.
  • Password: obtain your feed authorization key and use it as the -p option’s value.

Use the command below to add DevExpress as a NuGet package source:

# Add DevExpress as a package source
dotnet nuget add source https://nuget.devexpress.com/api -n DXFeed -u DevExpress -p {your-feed-authorization-key}

# Add packages to your project
dotnet add {ProjectName}.csproj package DevExtreme.AspNet.Core -v 21.1.5

Non-Windows operating systems do not support password encryption. To store credentials as plain text on these systems, add the --store-password-in-clear-text option to the command:

# Add DevExpress as a package source
dotnet nuget add source https://nuget.devexpress.com/api -n DXFeed -u DevExpress -p {your-feed-authorization-key} --store-password-in-clear-text

Use NuGet Feed URL

This approach uses a NuGet feed URL that specifies a package source for installed NuGet packages.

# Add DevExtreme.AspNet.Core to the current project
# Use the -s key to specify the package source
dotnet add package DevExtreme.AspNet.Core -s https://nuget.devexpress.com/{your-feed-authorization-key}/api  -s https://api.nuget.org/v3/index.json

.NET CLI: Miscellaneous Commands

Once installed, you can manage DevExpress packages like other NuGet packages, for example, remove them.

# Remove the DevExtreme.AspNet.Core package
dotnet remove package DevExtreme.AspNet.Core

# Automatically install all the dependencies in the project file 
dotnet restore

Refer to Microsoft documentation for more information on how to use the .NET CLI to manage packages: .NET CLI.

NuGet CLI: 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.

Use 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}

Use 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

NuGet CLI: Miscellaneous 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.