How to Install Nuget Package in C#?
Last Updated : 15 Dec, 2022
In this tutorial, we will be seeing how to install NuGet packages in C#. NuGet is the official package-manager for .NET. Packages are basically compiled libraries with some descriptive metadata. NuGet is an important tool for any modern development platform through which developers can create, share, and consume useful code. NuGet packages can also be defined as "re-usable and pre-defined pieces of code which benefit other developers as well".
Prerequisites: Visual Studio, Stable Internet, C#
Downloading and Installation of Nuget package in C#
Follow the further steps to install Nuget Package in C#
Step 1: Creating or Opening an existing project
NuGet packets are installed in projects and hence we first need to create a project or open an existing one.
In this particular tutorial, we will be creating a MVC project. Here we are using Visual Studio 2019 and naming the project as NugetDemo.
Click on create a new project and choose ASP.NET Web Application(.NET Framework) and click next.
Step 2: Then we name the project. Here it is named as NugetDemo and click Create.
Step 3: Next click MVC and click on the create button.
After following the above steps, the project has been created and we shall now see the NuGet Package Installation. We are going to be installing the Bootstrap package. For more details on Bootstrap click here.
There are multiple approaches to do so.
Approach 1: Using Packet manager console to install Bootstrap package
Step 4: Go to Tools->NuGet Package Manager->Packet Manager Console
Step 5: Installing via commands
The general command syntax: Install-Package <package_name>
For Bootstrap the command will be: Install-Package bootstrap
Once installed you will get the following screen.
Note: You can even specify the version name however by default it is the latest one like in case of bootstrap it is 5.2.2.
For Bootstrap the command with the version specified will be: Install-Package bootstrap -Version 5.2.2
Once installed, you will get the following acknowledgment.
Approach 2: Using Manage packages for solution to install Bootstrap package
Step 4: Go to Tools->NuGet Package Manager->Manage NuGet Packages for Solution...
The below screen will appear and now search for the required package in Browse, and choose the version(optional).
Step 5: Click install on the bottom right corner.
After clicking install wait for a few seconds and you shall get a confirmation as follows:
Note: In order to install or uninstall NuGet packages make sure your project is not running. If it is, stop running, install or uninstall and then build the project and run.
Similar Reads
How to Install a New Package Manager in Linux
Linux offers several package managers for software installation, updates, and maintenance. In Linux, every distribution comes with a package manager by default. The Debian distribution comes with APT(Advanced Package Tool), Red Hat, and its derivatives such as CentOS and Fedora use YUM package manag
4 min read
How to Install npgsql in c#?
Npgsql is a .NET data provider for PostgreSQL, a popular open-source database management system. It allows applications written in .NET languages (such as C# or VB.NET) to connect to and interact with a PostgreSQL database. Npgsql is an open-source .NET data provider for PostgreSQL, a popular open-s
2 min read
How to Install Package Manager in Windows 11?
Installing a package manager on Windows 11 is a convenient way to streamline your software management. One of the most popular tools for this purpose is Winget, the built-in Windows 11 package manager. With Winget, you can easily download, install, and update software via the command line, making it
5 min read
How to Install GIT by NPM Packages?
Git is a library for git written in Node.js which allows for the manipulation of git repositories by the Node.js application. Git (npm), not to be confused with GIT, the version control software is a Node.js port of the now-defunct Git project. It is fairly synchronous as-is, and it allows the devel
2 min read
How to install NumPy in PyCharm?
In this article, we will cover how to install the Python NumPy package in PyCharm. NumPy is a general-purpose array-processing Python package. It provides a high-performance multidimensional array object, and tools for working with these arrays. As one of the most important tool while working with d
2 min read
How to Install Multiple R Packages?
In this article, we will see how to install multiple packages in R Programming Language. Installation can be done in two ways. Method 1: Installation using application options Step 1: Open R Studio Step 2: Navigate to Tools and select the Install packages option Step 3: In the Text box packages, en
1 min read
How to Install and Remove Packages in Arch Linux
Arch Linux, known for its simplicity, flexibility, and user-centric approach, offers a robust package management system that allows users to easily install, update, and remove software packages. Unlike some other Linux distributions that come pre-packaged with software management tools, Arch Linux f
5 min read
How to Force an NPM Package to Install?
Forcing an NPM package to install can be necessary in cases where the dependencies of a package are in conflict or when you need to override existing constraints or force the installation of a specific version. Forcing an NPM package to install refers to using specific commands to bypass version con
3 min read
How to Install ntopng in Linux?
ntopng is an Open Source Tool to monitor the network. It is a security network monitoring tool, also monitors web activities passively. It is also used for packet capturing, Traffic Recording, and Network Probing. A huge number of companies like Google, HP, Cisco, IBM, and many more uses ntop. It ac
2 min read
How to Install PowerShell in Linux?
PowerShell is well-known among Windows administrators. It is a.NET-based task-based command-line shell and scripting language. You can quickly automate tasks for operating system maintenance and much more with PowerShell. PowerShell was once only available for Microsoft Windows. This admin tool, on
2 min read