Add/Update/Delete Package And Library From Nuget Package

What is NuGet
 
NuGet is the package manager for the Microsoft development platform including .NET. The NuGet client tools provide the ability to produce and consume packages. The NuGet Gallery is the central package repository used by all package authors and consumers.
 
We can add/update/delete package and library from nuget through the following two ways,
  1. Using  NuGet Packages dialog box
  2. Using the Package Manager Console.
NuGet Packages dialog box

Create empty project.

Open Visual Studio and press CTRL +SHIFT +N, go to web tab and give the name of project ManagingPackage then click on OK as in the following image,
 
  
 
So we have created empty project 
 
 Step 1: Now we will add package from Nuget into so right click on Project  and go to Manage Nuget Package. Click on it as in the following image,
    
 

You can see three tab on left side,,
  • Installed packages  -  click on this  you can see already installed package in project.
  • Online  -  from here you can add new package/lib into project.  
  • Update -  you can update the existing package/lib.   
Let us suppose I want to add  JQuery library into project as in the following image. If you will click on install and it will add the library into your project,
 
  
So I clicked on install and now let us see our project.
 
 

If you want delete it and then right click on project, click on Manage Nuget Package and go to installed package as in the following image,
 
 
For updating the package you have to click on update tab and if any upper version of installed package is available it will show on right side and if you will click on update it will update the package.

Second Method Using Package Manager Console
 
For add/update/delete package we use the following command,
  • Install‑Package  jQuery       - for adding package 
  • Update-Package  jQuery     - for updating the package
  • Uninstall-Package  jQuery  - for deleting the package
Let us see one by one.  

Open the package manager console.

Shortcut key to open package manager console press ALT +T +N + Enter key or from the Tools menu, select Nuget Package Manager and then click Package Manager Console as in the following image,

 
I want to add JQuery package so I have to type the following command on package manager console.

Install-Package jQuery.

 

For IntelliSense type inst and by pressing TAB  key you will get the following, 
 
 

For update and delete the package procedure is same as above: 
  • Update-Package jQuery - for updating the package
  • Uninstall-Package jQuery - for deleting the package
For more command refer this https://docs.nuget.org/consume/Package-Manager-Console-PowerShell-Reference#Update-Package.

Point of Interest  

In this article we learned how to add package into project through Nuget.

Up Next
    Ebook Download
    View all
    Learn
    View all