Daniel Forsyth
Daniel Forsyth

Reputation: 343

Adding an assembly reference in Visual Studio Code

I'm just working on a web project in VS code. I'm used to using the full blown IDE, but I'm developing for Linux, so I'm trying to see if I can accomplish the same things in VS code.

Basically it's gotten to a point where I need to add System.Web so I can use stuff from there, but I'm struggling to find how to do it. Usually I'd just right click the solution and go Add assembly reference, and all the .NET assemblies would be there.

I've found this answer, and I've added "System.Web.Http.Common": "4.0.20126.16343" to my project.json file. I can't find the dnu restore command though. I've read that it's deprecated, but can't find solid info on how to either install it or use its replacement if so. Is anyone able to help me?

EDIT: Sorry, I should mention I'm using Mono.

Upvotes: 1

Views: 5247

Answers (2)

ikolim
ikolim

Reputation: 16041

The new .NET Core SDK restore command is dotnet restore

To install the latest .NET Core SDK (Preview 2 version) and add any asssembly reference in Visual Studio Code, please refer to my post at How to add System.Data and System.Timers assembly references in Visual Studio Code 1.8?

Upvotes: 0

Swagata Prateek
Swagata Prateek

Reputation: 1086

dnu-restore is now dotnet-restore. You can find the help here

And if you're still using the rc1.0 version the details on dnu-restore is https://github.com/aspnet/Home/wiki/DNX-Utility.

If you are on Windows right now:

In case .net core is not installed in your machine follow the guidelines here

To have the CLI's anyway, you'd need .net core SDK which can be found here

Open VS2015 Developer command prompt or your command prompt in administrator mode (preferably) To create a new app: dotnet new To run an existing app: dotnet restore and then dotnet run

If you are on an Ubuntu right now:

To add the package source for Ubuntu 14.04:

sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list' sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893 sudo apt-get update

And for Ubuntu 16.04:

sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list' sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893 sudo apt-get update

Then you can install it using:

sudo apt-get install dotnet-dev-1.0.0-preview2-003121

Upvotes: 1

Related Questions