Adding NuGet Packages with Visual Studio Code

Adding NuGet Packages with Visual Studio Code

Create a new Project

File -> New Project is not an option here, so in order to creare a console app we need to do teh following:

File -> Open Folder and open or create a new folder where your new project will be. Then open Terminal via Terminal -> New Terminal and run the following commant to create a console app:

Add NuGet Packages

You can run the following commands from the Terminal

In most cases it works. I came across the problem when trying to add Newtonsoft.Json gave me a 401 error in the Terminal logs. Now what?

Install NuGet Package Manager to Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=jmrog.vscode-nuget-package-manager

Now in order to add packages you need to go View -> Command Palette or press Crt + Shift + P and type “>nuget” there

Select Add Package and then you can type the name of the package you are looking for. It worked better for me and I installed Newtonsoft.Json OK.


Leave a Reply

Your email address will not be published. Required fields are marked *