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
- NuGet Package Manager (GUI)
- NuGet Package Manager Console
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
When you select a package, an Install button appears, and a description is shown in the right-hand side.
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.
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.
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.
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.
The Package Manager Console Command window is display in visual studio below.
The two dropdownlists set default values that let you omit parameters from the commands you enter in the package manager console window :
- Package Source :
Package Source consist of 3 options
- Microsoft and .Net
- 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.
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
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
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.
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.
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: