Petar Ivanov
Petar Ivanov

Reputation: 191

How to install nuget package in ASP.NET Core project by the CLI

I'd like to add Microsoft.AspNetCore.StaticFiles to ASP.NET Core project.

Is there another way rather than editing manually the .csproj file? If I do nuget install it installs it in the current project folder and no change is applied to the .csproj file.

The OS is *nix one so I'm using VSCode and a terminal/console.

Upvotes: 10

Views: 8575

Answers (1)

Matt Ward
Matt Ward

Reputation: 47987

The .NET Core SDK which has support for the new Sdk style .csproj files allows you to do this from the command line if you are using a .csproj file.

dotnet add <PROJECT> package [arguments] [options]
dotnet add package Microsoft.AspNetCore.StaticFiles
dotnet add package Microsoft.AspNetCore.StaticFiles -v 1.0.1

If you are using project.json files then there is no command line support for that as far as I am aware.

Upvotes: 18

Related Questions