NuGet

Recipes

  • NuGet feeds sources: %APPDATA%\NuGet\NuGet.Config
  • VS package sources:
    • %ProgramData%\NuGet\Config\VisualStudio\14.0\Microsoft.VisualStudio.config
    • %Program Files%\NuGet\Config\Microsoft.VisualStudio.Offline.config
  • To prevent NuGet from restoring packages during build, open the Visual Studio Options dialog, click on the Package Manager node uncheck ‘Allow NuGet to download missing packages during build.

Commands

  • deprecated, returns a paged list of packages available online, with a search term and version history
Get-Package -ListAvailable -Filter Hangfire.Mongo -AllVersions -PageSize 5
  • Returns a list of packages installed in the default project that have updates available in the current package source.
Get-Package -Updates
  • install specific version without dependencies
Install-Package Hangfire.Mongo -IgnoreDependencies -Version 0.2.1
  • Installs jquery 1.10.2 package, using the .nupkg file under local path of c:\temp\packages.
Install-package c:\temp\packages\jQuery.1.10.2.nupkg
  • view local nupkg cache
cd %LOCALAPPDATA%\NuGet\Cache\
  • Forces an uninstall of the package even if another package depends on it. Uninstalls the package and its unused dependencies. If omitted, defaults to the latest version.
Uninstall-Package -RemoveDependencies Hangfire.Mongo -Version 0.2.1 -Force
  • display tabular / list details
| ft -AutoSize
| fl
  • (for NuGet 3.0 client or higher) Returns jquery package with all versions available from the package source.
Find-Package jquery -AllVersions -ExactMatch
  • detailed relevant package search
Find-Package -Id ZeroMQ -AllVersions | Select-Object ID, Version, Description, DownloadCount | Sort-Object -Descending -Property DownloadCount
  • NUnit inside MSTest, c# 6.0
Install-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform
Install-Package Microsoft.Net.Compilers
Install-package NUnit -Version 2.6.4
Install-package NUnitTestAdapter -Version 2.0.0