Skip to content

Commit 2723589

Browse files
committed
Supply RuntimeIdentifier graph to NuGet
Fix #3325
1 parent 08c09e3 commit 2723589

File tree

3 files changed

+3
-46
lines changed

3 files changed

+3
-46
lines changed

src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ public class ProcessFrameworkReferences : TaskBase
4949
[Output]
5050
public ITaskItem[] PackagesToDownload { get; set; }
5151

52-
[Output]
53-
public ITaskItem[] LegacyFrameworkPackages { get; set; }
54-
5552
[Output]
5653
public ITaskItem[] RuntimeFrameworks { get; set; }
5754

@@ -84,7 +81,6 @@ protected override void ExecuteCore()
8481
var frameworkReferenceMap = FrameworkReferences.ToDictionary(fr => fr.ItemSpec, StringComparer.OrdinalIgnoreCase);
8582

8683
List<ITaskItem> packagesToDownload = new List<ITaskItem>();
87-
List<ITaskItem> legacyFrameworkPackages = new List<ITaskItem>();
8884
List<ITaskItem> runtimeFrameworks = new List<ITaskItem>();
8985
List<ITaskItem> targetingPacks = new List<ITaskItem>();
9086
List<ITaskItem> runtimePacks = new List<ITaskItem>();
@@ -112,18 +108,6 @@ protected override void ExecuteCore()
112108
continue;
113109
}
114110

115-
if (frameworkReference != null && !string.IsNullOrEmpty(knownFrameworkReference.LegacyFrameworkPackages))
116-
{
117-
foreach (var packageAndVersion in knownFrameworkReference.LegacyFrameworkPackages.Split(';'))
118-
{
119-
var items = packageAndVersion.Split('/');
120-
TaskItem packageToReference = new TaskItem(items[0]);
121-
packageToReference.SetMetadata(MetadataKeys.Version, items[1]);
122-
123-
legacyFrameworkPackages.Add(packageToReference);
124-
}
125-
}
126-
127111
// Get the path of the targeting pack in the targeting pack root (e.g. dotnet/ref)
128112
TaskItem targetingPack = new TaskItem(knownFrameworkReference.Name);
129113
targetingPack.SetMetadata(MetadataKeys.PackageName, knownFrameworkReference.TargetingPackName);
@@ -230,11 +214,6 @@ protected override void ExecuteCore()
230214
PackagesToDownload = packagesToDownload.ToArray();
231215
}
232216

233-
if (legacyFrameworkPackages.Any())
234-
{
235-
LegacyFrameworkPackages = legacyFrameworkPackages.ToArray();
236-
}
237-
238217
if (runtimeFrameworks.Any())
239218
{
240219
RuntimeFrameworks = runtimeFrameworks.ToArray();
@@ -412,19 +391,6 @@ public KnownFrameworkReference(ITaskItem item)
412391

413392
public string Profile => _item.GetMetadata("Profile");
414393

415-
public string LegacyFrameworkPackages
416-
{
417-
get
418-
{
419-
var packages = _item.GetMetadata("LegacyFrameworkPackages");
420-
if (string.IsNullOrEmpty(packages))
421-
{
422-
packages = _item.GetMetadata("PackagesToReference");
423-
}
424-
return packages;
425-
}
426-
}
427-
428394
public NuGetFramework TargetFramework { get; }
429395
}
430396
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ Copyright (c) .NET Foundation. All rights reserved.
2525
Should be re-visited when multiple TFM support is added to Dependencies logic.
2626
-->
2727
<DefaultImplicitPackages>Microsoft.NETCore.App;NETStandard.Library</DefaultImplicitPackages>
28+
29+
<!-- Set RuntimeIdentifier graph for NuGet -->
30+
<RuntimeIdentifierGraphPath Condition="'$(RuntimeIdentifierGraphPath)' == ''">$(BundledRuntimeIdentifierGraphFile)</RuntimeIdentifierGraphPath>
2831
</PropertyGroup>
2932

3033
<!--

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ Copyright (c) .NET Foundation. All rights reserved.
7070
EnableTargetingPackDownload="$(EnableTargetingPackDownload)">
7171

7272
<Output TaskParameter="PackagesToDownload" ItemName="_PackageToDownload" />
73-
<Output TaskParameter="LegacyFrameworkPackages" ItemName="_LegacyFrameworkPackage" />
7473
<Output TaskParameter="RuntimeFrameworks" ItemName="RuntimeFramework" />
7574
<Output TaskParameter="TargetingPacks" ItemName="TargetingPack" />
7675
<Output TaskParameter="RuntimePacks" ItemName="RuntimePack" />
@@ -121,17 +120,6 @@ Copyright (c) .NET Foundation. All rights reserved.
121120
PrivateAssets="all"
122121
ExcludeAssets="all" />
123122
</ItemGroup>
124-
125-
<!-- Only add these "legacy" package references if there are already existing package references,
126-
as they are only needed in those scenarios (for example supplying the RID graph to
127-
NuGet, or preventing older versions of Framework packages from being used). -->
128-
<ItemGroup Condition="'@(PackageReference)' != '' and '$(DisableImplicitFrameworkReferences)' != 'true'">
129-
<PackageReference Include="@(_LegacyFrameworkPackage)"
130-
IsImplicitlyDefined="true"
131-
PrivateAssets="all"
132-
ExcludeAssets="all" />
133-
</ItemGroup>
134-
135123
</Target>
136124

137125
<!--

0 commit comments

Comments
 (0)