dotnet / dotnet/project-system

Add ability to easily add a Framework Reference to an SDK-style project

Open
#8,558 9 comments 4 reactions 0 assignees View on GitHub
Feature-Dependency-Node Tenet-User Friendly Triage-Approved
Dominant language
C#
Stars
1k
Forks
415
PR merge metrics
No merged PRs in 30d

Description

We often get questions from customers asking how to use ASP.NET Core types in class libraries, generally when they're trying to create reusable libraries of web-related code for their ASP.NET Core apps.

Discovering that one needs to add a framework reference to Microsoft.AspNetCore.App to the project is fairly difficult from within the product today, although [there are docs](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/target-aspnetcore?view=aspnetcore-6.0&tabs=visual-studio). One thing we can do to perhaps make this a smidge easier is make it simple to add Framework References from the Solution Explorer Dependencies node:

image

image

I'm envisaging a new context menu item there labelled "Add a Framework Reference..." that opens the add reference dialog on a new pane that allows selecting from a list of discovered shared frameworks (ref packs) for the version of .NET targeted by the project.

As an extension, having the editor be able to resolve types automatically from shared frameworks that aren't referenced and then add the required framework reference automatically (like is supported for types in unimported namespaces and unreferenced NuGet packages today) would be a hugely helpful addition. I imagine it would be a new addition to the "Suggest usings for types in..." options here:

image

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.