Manage Packages with .NET CLI

  • 2 minutes to read

The .NET CLI (command line interface) is a cross-platform tool that allows you to create and manage .NET application projects. You can use the .NET CLI to install or remove 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 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

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

Common 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.