Add .NET Package to The .csproj Project File

Adding a NuGet package to your .NET project is a great way to get access to functionality that you might not otherwise have.

NuGet is a package manager for .NET, which makes it easy to add and manage third-party libraries in your project. In this blog post, we will show you how to add a NuGet package to your .NET project using Visual Studio.

Add Package

To add a package, first, browse the NuGet website and find the package that you would like to add.

We use the Newtonsoft.Json package as shown below. Form the package page click on the PackageRefrence tab and copy the code.


To add the file to the .csproj file, open the project file and the lines below.

<PackageRefrence goes here>

After you add the above line paste the code from the PackageRefrence in the middle. Below you can see what to code looks like.

 <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />

Below is a screenshot of the entire .cspproj file.