Table of Contents

NuGet

Commands

dotnet restore .\SomeProject.csproj Restore NuGet packages by command line.
dotnet list .\SomeProject.csproj package List NuGet package dependencies of a project.
dotnet list .\SomeProject.csproj package --include-transitive List NuGet package dependencies of a project with transitive dependencies.
dotnet list .\SomeSolution.sln package --include-transitive List NuGet package dependencies of a solution with transitive dependencies.
$pkgId = "newtonsoft.json"
$version = "13.0.3"
"https://api.nuget.org/v3-flatcontainer/$pkgId/$version/$pkgId.nuspec"
(Open URI in browser - Invoke-RestMethod does not seem to work). List NuGet package dependencies from a repo. Not sure if this actually works.
dotnet nuget list source --format detailed List the NuGet package sources.
Get-ChildItem -Recurse -Directory | Where-Object { $_.Name -in @('bin','obj','packages') } | Remove-Item -Recurse -Force Remove all packages from a solution.

NuGet Source Locations

Scope Location Notes
User-level %APPDATA%\NuGet\NuGet.Config
Machine-level %ProgramFiles(x86)%\NuGet\Config\NuGet.Config Less common.
Project-level Any NuGet.Config file in your solution or project directory.

List them with the nuget sources list command.

Package Cache Locations