3

So I am new in C# and tried to load a project written in Visual Studio in Visual Studio Code. I'm curious as to why "references" option that was there in Solution Explorer in Visual Studio now gone in VSCode? Or maybe it is translated to something else in VSCode? Because now in VSCode I don't know how to add a reference for DemoLibrary.tests, for example, to DemoLibrary.

enter image description here

1
  • 4
    This is because Visual Studio is a full fledged IDE and VS Code is a lightweight text editor. If you want to access those references you can look at the project files directly. Commented Jul 13, 2021 at 14:01

2 Answers 2

2

All the references are stored in your DemoLibrary.Tests.csproj. You can edit them directly in there, or use the dotnet cli:

dotnet add DemoLibrary.Tests/DemoLibrary.Tests.csproj reference DemoLibrary/DemoLibrary.csproj 

Alternative commands are remove and list. You can find the documentation and examples here:

https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-add-reference https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-list-reference https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-remove-reference

Please keep in mind, that VSCode is a text editor (on steroids), not a full fledged IDE - although it comes pretty close in some cases.

Sign up to request clarification or add additional context in comments.

1 Comment

Visual Studio is a top notice IDE that's been actively advanced in features since the early 1990s. VS Code is a great text editor, still relatively young in development age, and with countless awesome external plugins. Visual Studio is meant for Professional developers who spend near-endless hours coding. VS Code is a great tool to get up an running with a development environment.
1

Because VSCode opens the raw folder view for you, while Visual Studio instead shows the actual logical solution/project data structure suitable for .NET development.

You can try to open the folder in VS and you will get the same experience as VSCode.

All package pages on NuGet.org show various ways to add packages to your projects so many do work with VSCode.

For example, click the PackageReference tab on https://www.nuget.org/packages/Json.Net/ and it shows what element you should add to project files directly.

BTW, you should not use packages.config any more. The whole ecosystem is now around package references.

And you seem to download a very old sample (using .NET Framework), which will give you more pains due to breaking changes. Try to find fresh and new sample projects (like the ones on .NET Core) please.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.