Skip to content

Conversation

@nkolev92
Copy link
Member

Bug

Fixes: https://github.com/NuGet/Client.Engineering/issues/3110

Description

Enable package pruning for .NET 10 preview 1.

Note that while we double insert into .NET 9 and .NET 10, the SDKAnalysisLevel check ensures we only enable it for .NET 10.

PR Checklist

@nkolev92 nkolev92 requested a review from a team as a code owner January 25, 2025 00:47
jeffkl
jeffkl previously approved these changes Jan 25, 2025
@nkolev92
Copy link
Member Author

I'll merge this optimistically since we might need to do an insertion.

@nkolev92 nkolev92 merged commit 2b3475a into dev Jan 27, 2025
23 checks passed
@nkolev92 nkolev92 deleted the dev-nkolev92-enablePruning branch January 27, 2025 21:45
jonathanpeppers added a commit to dotnet/java-interop that referenced this pull request Feb 11, 2025
Context: NuGet/NuGet.Client#6239

.NET 10 Preview 1 enables `$(RestoreEnablePackagePruning)=true` by
default.

This produces multiple warnings as errors in dotnet/android:

    external\Java.Interop\tests\Java.Interop.Dynamic-Tests\Java.Interop.Dynamic-Tests.csproj :
    error NU1510: Warning As Error: PackageReference Microsoft.CSharp will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary.

The `Microsoft.CSharp` package does seem like it can just be removed.
jonathanpeppers added a commit to dotnet/android that referenced this pull request Feb 11, 2025
Context: NuGet/NuGet.Client#6239

.NET 10 Preview 1 enables `$(RestoreEnablePackagePruning)=true` by default.

This produces multiple warnings as errors in dotnet/android:

    src\Xamarin.Android.Build.Tasks\Tests\Xamarin.ProjectTools\Xamarin.ProjectTools.csproj : warning NU1510: PackageReference System.Formats.Asn1 will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary.
    src\Xamarin.Android.Build.Tasks\Tests\Xamarin.ProjectTools\Xamarin.ProjectTools.csproj : warning NU1510: PackageReference Microsoft.Win32.Registry will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary.
    src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Xamarin.Android.Build.Tests.csproj : warning NU1510: PackageReference System.Formats.Asn1 will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary.
    external\debugger-libs\Mono.Debugging\Mono.Debugging.csproj : warning NU1510: PackageReference System.Buffers will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary.
    external\debugger-libs\Mono.Debugging\Mono.Debugging.csproj : warning NU1510: PackageReference System.Collections.Immutable will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary.
    external\debugger-libs\Mono.Debugger.Soft\Mono.Debugger.Soft.csproj : warning NU1510: PackageReference System.Runtime will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary.
    external\debugger-libs\Mono.Debugger.Soft\Mono.Debugger.Soft.csproj : warning NU1510: PackageReference System.Reflection.Metadata will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary.
    tests\MSBuildDeviceIntegration\MSBuildDeviceIntegration.csproj : warning NU1510: PackageReference System.Formats.Asn1 will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary.
jonathanpeppers added a commit to mono/debugger-libs that referenced this pull request Feb 11, 2025
Context: NuGet/NuGet.Client#6239

.NET 10 Preview 1 enables `$(RestoreEnablePackagePruning)=true` by default.

This produces multiple warnings as errors in dotnet/android:

    external/debugger-libs/Mono.Debugger.Soft/Mono.Debugger.Soft.csproj : warning NU1510: PackageReference System.Runtime will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary.
    external/debugger-libs/Mono.Debugger.Soft/Mono.Debugger.Soft.csproj : warning NU1510: PackageReference System.Reflection.Metadata will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary.

It appears we can safely remove these references for `net6.0`
`$(TargetFramework)`.
jonathanpeppers added a commit to mono/debugger-libs that referenced this pull request Feb 11, 2025
Context: NuGet/NuGet.Client#6239

.NET 10 Preview 1 enables `$(RestoreEnablePackagePruning)=true` by default.

This produces multiple warnings (as errors) in dotnet/android:

    external/debugger-libs/Mono.Debugger.Soft/Mono.Debugger.Soft.csproj : warning NU1510: PackageReference System.Runtime will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary.
    external/debugger-libs/Mono.Debugger.Soft/Mono.Debugger.Soft.csproj : warning NU1510: PackageReference System.Reflection.Metadata will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary.
    external/debugger-libs/Mono.Debugging/Mono.Debugging.csproj : warning NU1510: PackageReference System.Buffers will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary.
    external/debugger-libs/Mono.Debugging/Mono.Debugging.csproj : warning NU1510: PackageReference System.Collections.Immutable will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary.

It appears we can safely remove these references for `net6.0`
`$(TargetFramework)`.
jonathanpeppers added a commit to dotnet/java-interop that referenced this pull request Feb 11, 2025
Context: NuGet/NuGet.Client#6239

.NET 10 Preview 1 enables `$(RestoreEnablePackagePruning)=true` by
default.

This produces multiple warnings as errors in dotnet/android:

    external\Java.Interop\tests\Java.Interop.Dynamic-Tests\Java.Interop.Dynamic-Tests.csproj :
    error NU1510: Warning As Error: PackageReference Microsoft.CSharp will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary.

The `Microsoft.CSharp` package does seem like it can just be removed.
thaystg pushed a commit to mono/debugger-libs that referenced this pull request Feb 11, 2025
Context: NuGet/NuGet.Client#6239

.NET 10 Preview 1 enables `$(RestoreEnablePackagePruning)=true` by default.

This produces multiple warnings (as errors) in dotnet/android:

    external/debugger-libs/Mono.Debugger.Soft/Mono.Debugger.Soft.csproj : warning NU1510: PackageReference System.Runtime will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary.
    external/debugger-libs/Mono.Debugger.Soft/Mono.Debugger.Soft.csproj : warning NU1510: PackageReference System.Reflection.Metadata will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary.
    external/debugger-libs/Mono.Debugging/Mono.Debugging.csproj : warning NU1510: PackageReference System.Buffers will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary.
    external/debugger-libs/Mono.Debugging/Mono.Debugging.csproj : warning NU1510: PackageReference System.Collections.Immutable will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary.

It appears we can safely remove these references for `net6.0`
`$(TargetFramework)`.
jonathanpeppers added a commit to dotnet/android that referenced this pull request Feb 18, 2025
Changes: dotnet/sdk@c0f88f2...2f1799b
Changes: dotnet/runtime@7324dd1...751acde

Updates:

* Microsoft.NET.Sdk: from 10.0.100-preview.2.25108.4 to 10.0.100-preview.2.25114.7
* Microsoft.NETCore.App.Ref: from 10.0.0-preview.2.25107.7 to 10.0.0-preview.2.25112.7
* Microsoft.NET.ILLink.Tasks: from 10.0.0-preview.2.25107.7 to 10.0.0-preview.2.25112.7

Other changes:

Context: NuGet/NuGet.Client#6239

dotnet/sdk/main enables `$(RestoreEnablePackagePruning)=true` by default.

This produces a warning in the `DotNetBuild()` MSBuild test, such as:

     warning NU1510: PackageReference System.Text.Json will not be pruned. Consider removing this package from your dependencies, as it is likely unnecessary.

Remove the package from the test to solve the warning.

Co-authored-by: Jonathan Peppers <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants