How to install NuGet Package in Visual Studio Code Linux Ubuntu

I wrote this article about running Visual Studio Code on Linux here and wanted to now create a more complicated console app.  To do this I wanted to install the Newtonsoft.Json NuGet Package.

To open the console where the commands are added select View –> Integrated Terminal from the menu bar.

I started with creating a .NET Core application in Visual Studio Core using this command, see Figure 1.

dotnet new console

image

Figure 1, creating a new Visual Studio Code .NET Core application on Linux

The way you add the package is by executing this dotnet command, see Figure 2.

dotnet add package Newtonsoft.Json

image

Figure 2, Adding a NuGet package to .NET Core application on Linux using Visual Studio Code

Pretty easy…now let’s go break something Smile