Wednesday, 26 April 2017

How to add a NuGet package to C# project in VSCode on Ubuntu

In VSCode open Terminal and use dotnet CLI command package and specify the name of the desired package (e.g. Newtonsoft.Json):

$ dotnet add package Newtonsoft.Json

This will add a reference to that NuGet package in project:

Output in VSCode:

This can be verified in the project file:

VSCode notifies us that there are unresolved dependencies:

If we click on Restore newtonsoft.json library gets downloaded to ~/.nuget/packages directory.

After resolving them we can start using object from the newly added package. Intellisense also works for new dependency assembly:

Post a Comment