List of Useful Commands for Nuget

2015/10/022 min read
bookmark this
Responsive image

Table of Contents

Introduction

Nuget is a dependency management system for web development. If you use it, you'll already be familiar with the following commands.

Install and Uninstall a Package

The first Nuget command is to install Angular, and the second one is to uninstall a Nuget package.

Install-Package angularjs -Version 1.4.6
UnInstall-Package angularjs

Update a Package

Nuget actually has more useful commands, like the following. Update a particular package in a project to the latest version:

Update-Package jQuery -ProjectName MyProject

This command is very useful too because it is able to reinstall all the packages for a specific project.

Update-Package -ProjectName MyProject -reinstall

Update Project by Defined Nuget File

Update-Package -ProjectName Pokemon.Shared -reinstall
update-package -reinstall -ignoreDependencies

Install Nuget Package to All Projects

Install a Nuget package to all projects in the current solution:

Get-Project -All | Install-Package Autofac

Install Nuget Package to Certain Projects

Install a Nuget package to specific projects in the current solution:

Get-Project ProjectA,ProjectB,ProjectC | Install-Package Autofac

For more commands, see the following links:

  • Nuget Update command
  • Nuget command line reference
  • Package Manager Console Powershell Reference
  • Nuget Create and Publish command

Conclusion

Nuget provides a rich set of commands for managing packages in your .NET projects. From installing and uninstalling individual packages to batch operations across multiple projects, these commands can significantly streamline your dependency management workflow.