User Tools

Site Tools


nuget

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
nuget [2021/11/11 20:28] – created stephennuget [2025/10/17 02:48] (current) stephen
Line 1: Line 1:
 ====== NuGet ====== ====== NuGet ======
  
-| ''<nowiki>dotnet restore .\Whatever.csproj</nowiki>'' | Restore NuGet packages by command line. |+===== Commands ===== 
 + 
 +| ''<nowiki>dotnet restore .\SomeProject.csproj</nowiki>'' | Restore NuGet packages by command line. | 
 +| ''<nowiki>dotnet list .\SomeProject.csproj package</nowiki>'' | List NuGet package dependencies of a project. | 
 +| ''<nowiki>dotnet list .\SomeProject.csproj package --include-transitive</nowiki>'' | List NuGet package dependencies of a project with transitive dependencies. | 
 +| ''<nowiki>dotnet list .\SomeSolution.sln package --include-transitive</nowiki>'' | List NuGet package dependencies of a solution with transitive dependencies. | 
 +| ''<nowiki>$pkgId = "newtonsoft.json"</nowiki>''\\ ''<nowiki>$version = "13.0.3"</nowiki>''\\ ''<nowiki>"https://api.nuget.org/v3-flatcontainer/$pkgId/$version/$pkgId.nuspec"</nowiki>'' | (Open URI in browser - Invoke-RestMethod does not seem to work). List NuGet package dependencies from a repo. Not sure if this actually works. | 
 +| ''<nowiki>dotnet nuget list source --format detailed</nowiki>'' | List the NuGet package sources. | 
 +| ''<nowiki>Get-ChildItem -Recurse -Directory | Where-Object { $_.Name -in @('bin','obj','packages') } | Remove-Item -Recurse -Force</nowiki>'' | 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 ===== ===== Package Cache Locations =====
nuget.1636662528.txt.gz · Last modified: 2021/11/12 21:28 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki