Visual Studio 2017 References vs Dependencies

Viewed 27550

I have a .NET Core solution in visual studio 2017 that is building against the .NET 4.7 framework.

In the main web application there is a dependencies menu that breaks down references into logical categories (Analyzers, Assemblies, NuGet, Projects).

Dependencies Menu

In the helper project it only has a references menu with everything jumbled inside. Is there a way to get the same treatment here as the web application got?

enter image description here

3 Answers

It's based on the project file type. The older Full Framework project file gives you the References area, whereas the newer project files give you the Dependencies area. In other words, as long as it's a .NET Framework 4.7 project, there's nothing you can do about it.

That said, you can simply make it a .NET Standard 2.0 project, which does benefit from the new-style project file. Really, all your class libraries should be targeting .NET Standard, anyways, for greater interoperability.

No you can't get the same treatment. It's because of the project type. Different types of projects have different tooling and features.

In the old days before Asp.Net Core, projects generally just had the References area, and you could have references to other Visual Studio Projects or to Dlls (your own or System Dlls).

But Asp.Net Core provides a different interface for this sort of thing and provides better tooling support for NuGet for example. For Asp.Net Core projects all this is organized below the Dependencies area.

But if you right click on Dependencies and select "Add Reference..." in your Asp.Net Core project, or if you right click on References and select "Add Reference..." in your .Net 4.7 Framework library you will see that in both cases you are presented with the same dialog. So there is still some commonality in the UI ultimately used to add a reference.

I think the difference causing this is the project "style". You have access to that menu on an SDK-style project, while the helper project is probably a traditional-style project.

NET Core and NET Standard projects are created as SDK-style projects by default, while NET Framework projects are usually created as traditional-style projects, but it is possible to migrate them. SDK-style project files are much cleaner than traditional-style ones.

This open-source tool automates the grist of the migration. The following articles contain a guide: (Part 1, part 2)

Related