This would be a very short article on how to add dependencies in .NET Core.
Well, there are many ways to achieve this. One is via Visual Studio and another way is through command prompt. Let’s quickly have a look.
From Visual Studio
This is the straightforward way for the ones who want to use a user interface to add dependencies. Right click on your project/library and get it from NuGet gallery.
From Command Prompt
If you are a command prompt fan, then there itself, you have 2 choices.
- Open the command prompt. Navigate to your project directory and simply fire this command -
C:\<Your project directory> dotnet add package Microsoft.AspNetCore
- Alternatively, you can go and add the reference directly in .csproj file as shown below.
and restore it from the command prompt using a very simple command, i.e.,
C:\<Your project directory> dotnet restore
Happy learning!!!