-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Make private runtime-only dependencies on .NET Standard 2.0. #11109
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
base: main
Are you sure you want to change the base?
Conversation
f220ecc
to
16f3b06
Compare
The reference to immutable collections is surfaced to `Framework`. This lightens the NS2.0 reference assembly.
16f3b06
to
60122d6
Compare
Nice, I've been planning to do something like this (and likely even going further). Will look shortly. |
Let me know how further this can go, happy to do it now or in a subsequent PR. |
sorry for letting this be stale for such a long time. The spirit of the change is good, though it breaks CI now (not sure if it ever passed or just accumulated divergence from December). @teo-tsirpanis are you interested in finishing it? |
This failure is interesting:
Could it be because we inject references to specific versions of maintainenance packages in test projects? |
@JanProvaznik CI is now green. Most failures were due to my moving of the The solution is to update |
This reverts commit 60122d6.
434f802
to
0170975
Compare
Context
Since #6148 we produce only reference assemblies for .NET Standard 2.0, which means that several of the our NuGet packages' dependencies when targeting .NET Standard 2.0 are unused.
Changes Made
The project files for
Microsoft.Build.Framework
,Utilities.Core
andTasks
were updated to applyPrivateAssets="all"
to all package references that are not exposed in the package's public API, when targeting .NET Standard 2.0.Testing
I ran
dotnet pack
on these projects and validated manually that on .NET Standard 2.0,Microsoft.Build.Framework
has zero dependencies,Utilities.Core
depends only onFramework
, andTasks
depends only on the previous two.Because Roslyn keeps some internal APIs in reference assemblies, these reference assemblies still reference some assemblies whose respective package is not depended upon. I manually validated with ILSpy that the types in these assemblies are used only by internal APIs.
Notes
This is going to be a (minor) source-breaking change if a .NET Standard 2.0 project uses APIs from on one of the removed packages and transitively depended on it. They will have to directly depend on them, and it's not the first time we do a change like this (#9055).
I don't think that this is a binary-breaking change because the .NET Standard 2.0 binaries are not being used at runtime.