liveBook · Manning

Dotnet restore

As explained in ASP.NET Core in Action, 3e

dotnet restore is a .NET CLI command that downloads a project's package dependencies and establishes their references for building.

dotnet restore downloads the NuGet packages referenced by a project so the application has the dependencies needed for building and running. Run it from the project folder. Visual Studio and newer .NET CLI workflows usually restore automatically, but the explicit command makes the dependency step visible. section 3.2.2 section 27.1.1

Use restore as part of the normal project workflow:

  • Add a dependency as a PackageReference in the project file. section 12.2.1
  • Run dotnet restore in the project directory, or let Visual Studio restore the packages. section 12.2.1 section 3.2.2
  • Build or run the application; dotnet build and dotnet run normally invoke restore automatically. section 3.2.2

Restoring an EF Core provider

A project can reference Microsoft.EntityFrameworkCore.SQLite and Microsoft.EntityFrameworkCore.Design in its .csproj file. Running dotnet restore downloads these packages and prepares them for building the data model and application. section 12.2.1

How ASP.NET Core in Action, 3e covers it

How deep it goes
Explains package downloading, project-folder usage, and implicit invocation, but does not detail the restore algorithm.
Examples
Uses EF Core SQLite and Design PackageReference entries as a concrete restoration example.
What it assumes
Assumes a project file containing referenced packages and teaches the dependency-download step from the beginning.
What you can do after
Apply it via the .NET CLI to fetch project packages before building or running an application.
How it connects
Connects NuGet packages with PackageReference, dotnet build, dotnet run, Visual Studio, and Entity Framework Core.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.