Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propose NuGet.org portions of TFM spec #10573

Merged
merged 6 commits into from
Mar 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
109 changes: 109 additions & 0 deletions proposed/2021/NuGet.orgTFMs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# NuGet Target Frameworks on Package Details Page

- Author Name (https://github.com/jcjiang)
- Start Date (2021-02-16)
- GitHub Issue (https://github.com/NuGet/NuGetGallery/issues/4843)
- GitHub PR ()

## Summary

When a developer opens the package details page or tab on NuGet.org, they will see what frameworks the package can support.

## Motivation

### Problem: What problem is this solving?

Developers cannot use the package details page to determine what frameworks a NuGet package can support. In 2021, we live in a world where there are many evolutions of .NET coexisting on NuGet, such as .NET Framework and .NET 5.

Developers should be able to determine whether a package works for their project without having to first download it or rely on the author’s documentation.

### Why: How do we know this is a real problem and worth solving?

Finding a package that is compatible with your project is a challenge for the average developer in the .NET ecosystem. Over 21% of developers fail to install a package today. One of the top NuGet errors issued in telemetry is [NU1202](https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu1202), which shows that we allow developers to install packages that are not compatible with their project or solution’s target framework.

### Success: How do we know if we’ve solved this problem?

- By gauging excitement/disappointment after blogging about this feature & analyzing sentiment on Twitter/GitHub/DevCom/etc.
- Compare the before and after numbers for error messages due to TFM incompatibility. Is there a noticeable decrease? If so, how long after the feature was rolled out for the decrease?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Compare the before and after numbers for error messages due to TFM incompatibility. Is there a noticeable decrease? If so, how long after the feature was rolled out for the decrease?

Not a perfect metric, but some data to show

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the convo below, how many people click open the section to expand.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this metric to the spec.

### Audience: Who are we building for?

We are building this for the .NET developer who is browsing & making decisions about including a NuGet package into their project based on target framework & supported platform criteria.

## Explanation

### Functional Explanation

Context and Scope: When a developer accesses the details page for a NuGet package, they will see information on target frameworks in an expandable section. The framework information will be surfaced from the package.

Minimal Requirements:
- List of Target Frameworks on NuGet.org's package details page. The Frameworks node will be expanded by default.
- A series of tiles near package Id and version indicating supported platform--this will become more populated when .NET5.0's (TargetPlatformIdenitifiers)[https://github.com/NuGet/Home/issues/9240] are in the TFM (which we can display versionless with full details in Frameworks node), but for now we can have `.NET`, `.NET Core`, `.NET standard`, `Portable`, etc. TargetPlatformIdentifiers will give us iOS, Android, tvOS etc., perhaps grouped alongside .NET (which will be visibly 5.0 when the Frameworks node is viewed).
- Runtime, Content Build assets and Tools packages will display TFM details.
- Support for PackageReference project restore compatibility only.

**Target Framework** – A target framework is a specification of the APIs available to an application or library.

Example: .NET Framework, .NET Core, .NET Standard, .NET 5 are target frameworks.

**Supported Platform** – A supported platform is a target that the APIs can be ran on.

Example: iOS, Android, Windows are platforms.

- A .NET developer can view Frameworks of a package on NuGet.org:
![](../../meta/resources/NuGet.orgTFMs/PackageDetailsWithTFMs.png)
drewgillies marked this conversation as resolved.
Show resolved Hide resolved
drewgillies marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For new users, these may be rather opaque strings. Can we link to a "good" doc that the .NET team has (don't know which one) that explains these various frameworks.

Said, if I install the .NET SDK or Visual Studio and I want to hack away at a project, what good first document can I read to start understand this wonderful ✨ world of TFMs we have.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, I now see Unresolved questions. This covers some of my questions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@drewgillies drewgillies Feb 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great--I've added this to the Target Framework List section:

Let's link to an explanatory document for any frameworks we expose here, for example: https://docs.microsoft.com/en-us/dotnet/standard/frameworks#latest-versions

@jcjiang--I'm not entirely sure how this would need to look in UI. I initially asked you for a mockup, but I think it would just be the first text we see when expanding. Might need your help on wording though, and anything else we might want in there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Ping me when you are messing with wording, happy to help there.


- We will have the list collapsed by default in order to track popularity.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At an earlier point in time (about ~1 year ago), we did some analysis on what frameworks does a package really support vs what frameworks are declared in the dependencies section and we found that for about 95% of packages, these are a 1 to 1 relationship.

Have we consider making that more apparent instead? In the interest of saving some vertical space/introducing a new concept that's already covered in most scenarios.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good point. There's a challenge here where you run into the XUnit case.

image

To get to an actual "idea" of if the package supports a specific framework is layers deep to the dependencies defined such as:

image

So in these cases, we don't have a good answer without iterating dependencies.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That totally makes sense.

I just thing integrating it differently, not in an additive way might save us some space. Right now there's a lot.

Copy link
Contributor

@JonDouglas JonDouglas Feb 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We just need to consider a tab design for these pages as a "Future Possibility". Dependencies, Frameworks, Version History, Dependents (Used By), etc really belong in their own individual tabs so everything isn't stacked ontop of each other. README for example will make scrolling to get to one of these a default experience.

/cc @jcjiang may be worth adding to this section!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline and we'll consider these to be universally compatible at this stage. I've added - A design for meta packages to future possibilities, and splitting expanders out to tabs may be called out here or in anothr spec. Up to you, @jcjiang. As we've nailed down the pertinent corner cases, for now perhaps we can merge this?


### Goals and Non-Goals

#### Goals

Make it clear to developers whether a package can be installed or updated for their project or solution based on a target framework.
drewgillies marked this conversation as resolved.
Show resolved Hide resolved


### Design

#### Target Framework List

Let's link to an explanatory document for any frameworks we expose here, for example: https://docs.microsoft.com/en-us/dotnet/standard/frameworks#latest-versions
- .NET Framework (net)
- Xamarin/Mono (monoandroid, monotouch, xamarinios, monomac, xamarinmac, xamarinwatchos, xamarintvos)
- .NET Core (netcoreapp)
- .NET Standard (netstandard)
- .NET 5 (net5.0)

### Technical Explanation
- Packages whose layout follow our [guidelines](https://docs.microsoft.com/en-us/nuget/create-packages/supporting-multiple-target-frameworks) will be examined when uploaded and validated, prior to listing. Target Frameworks will be determined and displayed here.
- Note that packages which do not follow the guidelines may have inconsistent results.
- In cases where versions are not specified (such as .net) or other unexpected scenarios, these will be considered v0.0 and will be displayed as such.
- When a portable TFM is being broken up and displayed (if feasible), we will need to flag it as portable, as portable assets are not the same as platform assets.

## Drawbacks
- We would need to focus on compatibility with PackageReference and not packages.config projects, as these two support compatibility in different ways.

## Rationale and alternatives
Q: I think build/{packageid}.[props|targets] poses a problem, because from NuGet's point of view this package is compatible with all TFMs, .NET, native/c++, or anything else. For packages like Nerdbank.GitVersioning, or SourceLink, this makes sense. But many .NET packages incorrectly use this, rather than build\{tfm}\{packageid}.[props|targets]. I think it's worthwhile pointing this out and explaining what our plan is for these packages.
A: Let's consider putting a link to a document which can call out corner cases such as this, and respond to direct customer concerns with advice on nupkg construction conducive to correct supprted TFM assessment.

Q: Will the "Frameworks" section be expanded by default? Should the "Frameworks" section explain how the customer should use this information? Should we add a link to docs? Consider moving up the "Frameworks" section. I would suggest "Documentation" first, followed by "Frameworks". The "Version History" table is noisy and it can be difficult to see what's below it. The "Dependencies" and "Used By" sections are useful information, but would claim "Frameworks" is more important.
A: Let's not expand by default--this will give us the option of trackiong the popularity of the section by tracking expansion clicks.

Q: Potentials for modelling our UX on:
- https://docs.microsoft.com/en-us/dotnet/api/system.text.stringbuilder?view=net-5.0#applies-to
- https://apisof.net/catalog/e40ef6ad-bd6e-9f29-7864-b942e37be11f
- https://docs.microsoft.com/en-us/dotnet/standard/frameworks#latest-versions

A: From a sample of 100,000 package/versions, we have:
- Only 445 have more than 5 supported TFMs
- Only 16 have more than 10
- Only 1 more than 15 (and it has 16)
So, we'll go with a flat list for now and look at other options for subsequent work if desired.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can also work with folks on the UX side, accessibility of information here is more of a PM/UX question so happy to chase that down


### Unresolved questions
drewgillies marked this conversation as resolved.
Show resolved Hide resolved
drewgillies marked this conversation as resolved.
Show resolved Hide resolved


## Future Possibilities

- Filtering NuGet.org search by TFM
- TFM display in Visual Studio