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

Remove unnecessary ref source projects from Microsoft.Bcl packages #105312

Merged
merged 2 commits into from
Jul 23, 2024

Conversation

ViktorHofer
Copy link
Member

@ViktorHofer ViktorHofer commented Jul 23, 2024

Remove unused reference assembly projects from Bcl folders

Contributes to #58163

See the linked issue for more details. The most important detail here is that runtime nuget packages don't include reference assemblies anymore so those projects aren't useful and only slow down the restore and build.

Commit 1:

  • Remove unused reference assembly projects and move the
    forwards.cs files into the src folder.
  • Don't rely on IsPartialFacadeAssembly switch anymore
    which makes it possible to use the compiler generated xml
    file and removes the dependency on the reference source project.
  • Enable package baseline validation for Microsoft.Bcl.Numerics
  • Update a few package descriptions to remove the exposed types
    in favor of the information listed in the package readmes.

This improves restore and build perf in total as well as per leaf
project on the CLI and inside VS.

Commit 2:

  • Update projects that now need to reference the src project as
    the ref project got deleted.
  • Remove target that validates that ref projects only reference ref
    project. That target doesn't make sense anymore with our direction
    towards removing reference assembly projects.

APICompat and package baseline validation validates that this change doesn't impact the public API surface area.

Contributes to #58163

- Remove unused reference assembly projects and move the
  forwards.cs files into the src folder.
- Don't rely on IsPartialFacadeAssembly switch anymore
  which makes it possible to use the compiler generated xml
  file and removes the dependency on the reference source project.
- Enable package baseline validation for Microsoft.Bcl.Numerics

This improves restore and build perf in total as well as per leaf
project on the CLI and inside VS.
- Update projects that now need to reference the src project as
  the ref project got deleted.
- Remove target that validates that ref projects only reference ref
  project. That target doesn't make sense anymore with our direction
  towards removing reference assembly projects.
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-infrastructure-libraries
See info in area-owners.md if you want to be subscribed.

@ViktorHofer
Copy link
Member Author

/ba-g dead lettered helix queue

@ViktorHofer ViktorHofer merged commit 3028ee9 into main Jul 23, 2024
144 of 149 checks passed
@ViktorHofer ViktorHofer deleted the RemoveUnnecessaryRefSourceProjects branch July 23, 2024 16:15

namespace System.Buffers.Text
{
public static class Base64Url
Copy link
Member

@stephentoub stephentoub Aug 6, 2024

Choose a reason for hiding this comment

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

@ViktorHofer, I'm confused by this change. Where does the netstandard2.0 ref for this come from now that this is deleted? Is the idea that we no longer ship a ref and just let the implementation assembly be the surface area? Or rely on Roslyn to generate a ref assembly from the implementation assembly?

Copy link
Member

Choose a reason for hiding this comment

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

That's the idea afaik yeah. From the linked issue:

Since .NET 6, out-of-band reference assemblies like Microsoft.Extensions.* don't ship to customers anymore as they aren't part of the generated packages. Their sole purpose today is infrastructure only needs (ApiCompat and GenFacades).

/cc @ericstj

Copy link
Member Author

@ViktorHofer ViktorHofer Aug 8, 2024

Choose a reason for hiding this comment

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

I'm out on leave but just saw this message. Yes, @akoeplinger is correct. Reference assemblies that don't ship inside a shared framework don't reach the customer anymore. This started between .NET 5 and .NET 6.

Example:
https://nuget.info/packages/System.Data.Odbc/5.0.0 (has a "ref" folder)
https://nuget.info/packages/System.Data.Odbc/8.0.0 (doesn't have a "ref" folder)

Microsoft.Bcl packages are in the same boat, i.e. AsyncInterfaces already haven't had a ref folder before this change: https://nuget.info/packages/Microsoft.Bcl.AsyncInterfaces/9.0.0-preview.6.24327.7

Therefore we don't need to even let Roslyn generate them.

For libraries that ship inside any of our available shared frameworks (Microsoft.NETCore.App.Ref, Microsoft.AspNetCore.App.Ref and Microsoft.WindowsDesktop.App.Ref) we need reference assemblies. The idea here is that we let the compiler automatically generate them from the implementation assembly instead of us hand authoring them via dedicated ref projects (#58163).

@github-actions github-actions bot locked and limited conversation to collaborators Sep 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants