NuGet
When you use NuGet to install a package, it copies the library files to your solution and automatically updates your project (add references, change config files, etc.). If you remove a package, NuGet reverses whatever changes it made so that no clutter is left, but make sure your changes are not removed.From the Tools menu, select Library Package Manager and then click Package Manager Console.
Get existing packages in your project
command: Get-Package
Display list of all packages you have in selected project.
Get all packages available
Command: Get-Package -ListAvailable
Gets you list of all packages that are available for you to install.
Executing the command looks like:
Get existing packages in your project
Command:
Get-Package -ListAvailable -Filter [package name]
Example Command:
Get-Package -ListAvailable -Filter Castle.Core
Search for name based on contains filter. Where instead of [search Package]
you use name you are looking for.
Get existing packages in your project
Command:
install-package [package name]
Example Command:
install-package Castle.Core
Notice the highlighted are on image below. Make sure you select the project where you want to install the package.
And after installing you will get message.
Remove package from your project
Command:
uninstall-package [package name]
Example Command:
uninstall-package Castle.Core
Remove the package from project, again make sure that you have selected project you want to remove the package from, as highlighted on image below.
Hint:
If you do not already know the name of the package you want to remove, enterGet-Package
at the prompt without any flags to see a list of all of the packages that are currently installed.
Include pre-release package
If you are like me, you want to get your hands on data that are still in beta version. This command will allow you to do this.
Command:
install-package [package name]
-includeprerelease
Example Command:
uninstall-package EntityFramework -includeprerelease
Install specific version
Quite often you need to install package specific to your project, from time you have started to write it.
Command
Install-Package EntityFramework -Version 1.2.0
Commands:
Enable migrations:
Command:
Enable-Migrations
To see more go and visit Package Manager Console Powershell Reference
No comments:
Post a Comment