Skip to content

Commit 454bd3f

Browse files
authored
Move pruning defaults back to the NuGet.targets (#49943)
1 parent a42d38b commit 454bd3f

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,15 @@ Copyright (c) .NET Foundation. All rights reserved.
5050

5151
</CreateWindowsSdkKnownFrameworkReferences>
5252
</Target>
53-
53+
54+
<!-- TODO: https://github.com/dotnet/sdk/issues/49917 Remove the framework based condition when the data for netcoreapp2.1 and below is fixed-->
5455
<Target Name="AddPrunePackageReferences" BeforeTargets="CollectPrunePackageReferences"
5556
DependsOnTargets="ProcessFrameworkReferences"
5657
Condition="'$(RestoreEnablePackagePruning)' == 'true'
57-
AND '$(TargetFrameworkIdentifier)' == '.NETCoreApp'
58+
AND (('$(TargetFrameworkIdentifier)' == '.NETCoreApp'
5859
AND '$(TargetFrameworkVersion)' != ''
59-
AND $([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '8.0'))">
60-
60+
AND $([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '3.0')))
61+
OR ('$(TargetFrameworkIdentifier)' != '.NETCoreApp'))">
6162
<PropertyGroup>
6263
<PrunePackageDataRoot Condition="'$(PrunePackageDataRoot)' == ''">$(NetCoreRoot)\sdk\$(NETCoreSdkVersion)\PrunePackageData\</PrunePackageDataRoot>
6364
<PrunePackageTargetingPackRoots Condition="'$(PrunePackageTargetingPackRoots)' == ''">$(NetCoreTargetingPackRoot)</PrunePackageTargetingPackRoots>

test/Microsoft.NET.Build.Tests/GivenThatWeWantToResolveConflicts.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -316,21 +316,21 @@ public void PlatformPackagesCanBePruned(bool prunePackages)
316316
[InlineData(ToolsetInfo.CurrentTargetFramework)]
317317
[InlineData("net9.0")]
318318
[InlineData("net8.0")]
319-
// [InlineData("net7.0", false)] TODO: https://github.com/NuGet/Home/issues/14424
320-
// [InlineData("net6.0", false)] TODO: https://github.com/NuGet/Home/issues/14424
321-
// [InlineData("netcoreapp3.1")] TODO: https://github.com/NuGet/Home/issues/14424
322-
// [InlineData("netcoreapp3.0")] TODO: https://github.com/NuGet/Home/issues/14424
323-
[InlineData("netcoreapp2.1", false)]
324-
[InlineData("netcoreapp2.0", false)]
319+
[InlineData("net7.0")]
320+
[InlineData("net6.0")]
321+
[InlineData("netcoreapp3.1")]
322+
[InlineData("netcoreapp3.0")]
323+
[InlineData("netcoreapp2.1", false)] //TODO: https://github.com/dotnet/sdk/issues/49917
324+
[InlineData("netcoreapp2.0", false)] //TODO: https://github.com/dotnet/sdk/issues/49917
325325
[InlineData("netcoreapp1.1", false)]
326326
[InlineData("netcoreapp1.0", false)]
327-
[InlineData("netstandard2.1", false)]
328-
[InlineData("netstandard2.0", false)]
327+
[InlineData("netstandard2.1")]
328+
[InlineData("netstandard2.0")]
329329
[InlineData("netstandard1.1", false)]
330330
[InlineData("netstandard1.0", false)]
331331
[InlineData("net451", false)]
332-
[InlineData("net462", false)]
333-
[InlineData("net481", false)]
332+
[InlineData("net462")]
333+
[InlineData("net481")]
334334
public void PrunePackageDataSucceeds(string targetFramework, bool shouldPrune = true)
335335
{
336336
var nugetFramework = NuGetFramework.Parse(targetFramework);

0 commit comments

Comments
 (0)