Introduction
We can say that NuGet packages are predefined pieces of code that are reusable for other developers. You can add them in your project and use that Nuget functionality where ever you want. We can also say that it's like a platform where developers can create and share code to the world. It contains DLL compile code, which is nearly impossible to decrypt.
Prerequisites
Step 1 - Create a Project
- We can install NuGet packages in any .NET project that supports the same target framework as that of the created project.
- For this demo, I'm using a normal MVC Project.
Step 2 - Open NuGet Package Manager
Now, there are two options to open the NuGet Package Manager window.
- Select Tools > NugGet Package Manager > Manage NuGet Packages for solution.
- Go to your Solution Explorer, right-click on References, and choose Manage NuGet Packages.
Step 3 - Search and install your required NuGet.
- In this window, you can search, install, uninstall, and update any NuGet Package and also see the full list of installed NuGet Packages.
- Once you click on the Install button and click on "I Agree" from the pop-up window, then that particular package will install/add to your project.
- Here, I am installing EntityFramwork NuGet Package.
Once you have installed it successfully, the following message will be displayed.
Here, you can see your installed project. Go to Solution Explorer > Reference, and expand it.
Now, you can access that package/code into your project.
Note
You can also install NuGet using the Package Manager Console.
Step 1 - Select Tools > NuGet Package Manager > Package Manager Console.
It will open a console in the bottom of the window.
Step 2 - Select your project and execute the command to install the package.
If it's a valid command, then the package will be installed to your project.