ASP.NET : Nuget Package Manage


What is NuGet Package Manage

NuGet Package Manage is a collection of tools to automate the process of Downloading, Installing, Upgrading, Configuring and Removing package from a Visual Studio project.
we can work with NuGet Package Manager in two ways

  1. NuGet Package Manager (GUI)
  2. NuGet Package Manager Console


1.) NuGet Package Manage (GUI) :
Nuget Package Manager in asp.net


NuGet Package Manag is used to find, install, update and remove packages by using GUI of NuGet Package Manager. To search for package
goto --> Solution Explorer --> right-click --> on References or Project Name --> click on Manage NuGet Packages.




Find and Install Package in NuGet Package Manager:

To display list of available packages first we need to select Online Tab in left side section i.e Box 1 as i shown in below image

Manager Nuget Package

search for a package using the search box at the top right of the Manage Nuget Packages Windows. For example, to find the Javascript package named JQuery, enter JQuery in Search Box as i shown in above image Box 2.
When you select a package, an Install button appears, and a description is shown in the right-hand side.

Nuget package Manager installation
Click on Install Button to install a JQuery package in your project. Once Installation done in your project few change occurs automatically
a.) packages.config file is created
b.) Script folder created under this folder JQuery files are copied.
c.) Reference might be added to the project
d.) Web.Config or App.Config file might be updated in your project.

When the installation completes, the Install button turns into a green check mark to indicate that the package was installed correctly.

Installation done successfull in Nuget Package Manager


Remove Package in Nuget Package Manager :

Open the Manage NuGet Packages Window and click on Installed Packages tab from left hand side and select ALL is used to display the list of installed packages.
Select the package you want to uninstall and then click Uninstall to remove the package.

Uninstall nuget package
Once Uninstallation done in your project few change occurs automatically a.) packages.config file is removed
b.) Script folder created under this folder JQuery files are deleted or removed.
c.) Reference might be remove to the project
d.) under Web.Config or App.Config file unnecessary code should be remove programmer manually


Update Package in NuGet Package Manager :

Open the Manage NuGet Packages Window and make sure the Updates tab is selected to display the list of packages that have newer versions available.
If any packages have updates available, they will be listed in the center pane. The following screenshot shows a newer version of jQuery available.

Update nuget package

2.) NuGet Package Manage Console :

NuGet Package Manage Console is used to find, install, update and remove packages by using PowerShell commands.To search for package
open visual studio -- Tools Menu --> NuGet Package Manager --> click on Package Manager Console.

Package Manager Console

The Package Manager Console Command window is display in visual studio below.

package manager console command window
The two dropdownlists set default values that let you omit parameters from the commands you enter in the package manager console window :
  1. Package Source :
    Package Source consist of 3 options
    • ALL
    • nuget.org
    • Microsoft and .Net
    choose one source in package source that you want your commands to use.
  2. Default Project :
    select the default project that you want your commands to work.


Find and Install Package in Package Manager Console :


In the Package Manager Console command window, enter Get-Package -ListAvailable in the Command window to see a list of all packages that are available in the selected package source.

Find JQuery in Package Manager Console

when we execute Get-Package -ListAvailable, that command is going to list thousands of packages. It makes better sense to specify a filter.
For example, to find the JQuery package, enter Get-Package -ListAvailable -Filter JQuery or Get -Package -Filter JQuery -ListAvailable

filter jquery package console command windows

Install :

After you have found a package that you want to install, use the Install-Package command with the name of the package. For example, enter the command Install-Package jQuery.ui.all as shown in the following example
install JQuery through package console command window

Update Package in Package Manager Console :

To check if there are newer versions available for any installed packages, enter Get-Package -updates at the prompt.

update jquery package in package manager console

To update a package, enter Update-Package with the package ID. For example, enter the command Update-Package jQuery



Remove Package in Package Manager Console :

If you do not already know the name of the package you want to remove, enter Get-Package at the prompt without any flags to see a list of all of the packages that are currently installed.

get package details in package manger console

To remove a package, use the Uninstall-Package command with the name of the package. For example, use the Uninstall-Package jQuery command as shown in the following example:

Uninstall package in package manager console command windows
Tag : ASP.NET, NuGet
0 Komentar untuk "ASP.NET : Nuget Package Manage"

Back To Top