So I've come across a similar issue twice now while working on my first project in C#. When trying to add either using System.Data;
or using System.Timers;
, I get the following error:
The type or namespace name 'x' doesn't exist in the namespace 'System' (are you missing an assembly reference?).
I have tried beginning a new project and running restore
to see if I had accidentally removed something in the dependencies, but upon generating a new project I still receive the same error. I have tried to research the question and have seen answers referring to the 'solutions explorer', but as far as I can see there doesn't seem to be such a feature by this name in Visual Studio Code 1.8.
Can anyone point me in the right direction for how to get these working, perhaps by manually adding into the dependencies?
To add an assembly from project outputOpen the Package Designer. For more information, see How to: Customize a SharePoint solution package. Choose the Advanced tab. Choose the Add button, and then choose Add Assembly from Project Output from the list.
The following topic applies to .csproj
project file and : .NET Core 1.x SDK, .NET Core 2.x SDK
Adds a package reference to a project file.
dotnet add package
Add Newtonsoft.Json
NuGet package to a project:
dotnet add package Newtonsoft.Json
The following topic applies to .json
project file:
This guide walks you through the process of adding any assembly reference in Visual Studio Code. In this example, we are adding the assembly reference System.Data.SqlClient into .NET Core C# console application.
Note
Prerequisites
Steps
Click on NuGet Package Manager: Add Package
Enter package filter e.g. system.data (Enter your assembly reference here)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With