Skip to content

Commit f246190

Browse files
committed
Use implicit package reference for ILC build package
1 parent 0b8b524 commit f246190

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ public class ProcessFrameworkReferences : TaskBase
104104
[Output]
105105
public ITaskItem[] TargetILCompilerPacks { get; set; }
106106

107+
[Output]
108+
public ITaskItem[] ImplicitPackageReferences { get; set; }
109+
107110
// Runtime packs which aren't available for the specified RuntimeIdentifier
108111
[Output]
109112
public ITaskItem[] UnavailableRuntimePacks { get; set; }
@@ -621,6 +624,9 @@ private bool AddAotOrR2RRuntimePackage(AotPackageType packageType, Version norma
621624
else
622625
{
623626
HostILCompilerPacks = new[] { newItem };
627+
var ilCompilerBuildPackageReference = new TaskItem(knownPack.ItemSpec);
628+
ilCompilerBuildPackageReference.SetMetadata(MetadataKeys.Version, packVersion);
629+
ImplicitPackageReferences = new[] { ilCompilerBuildPackageReference };
624630
// ILCompiler supports cross target compilation. If there is a cross-target request, we need to download that package as well
625631
// We expect RuntimeIdentifier to be defined during publish but can allow during build
626632
if (RuntimeIdentifier != null)
@@ -643,7 +649,7 @@ private bool AddAotOrR2RRuntimePackage(AotPackageType packageType, Version norma
643649
TargetILCompilerPacks = new[] { newItem2 };
644650
}
645651
}
646-
}
652+
}
647653

648654
return true;
649655
}

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!--
1+
<!--
22
***********************************************************************************************
33
Microsoft.NET.Sdk.FrameworkReferenceResolution.targets
44
@@ -123,6 +123,7 @@ Copyright (c) .NET Foundation. All rights reserved.
123123
<Output TaskParameter="HostILCompilerPacks" ItemName="HostILCompilerPack" />
124124
<Output TaskParameter="TargetILCompilerPacks" ItemName="TargetILCompilerPack" />
125125
<Output TaskParameter="UnavailableRuntimePacks" ItemName="UnavailableRuntimePack" />
126+
<Output TaskParameter="ImplicitPackageReferences" ItemName="_ImplicitPackageReference" />
126127

127128
</ProcessFrameworkReferences>
128129

@@ -175,6 +176,15 @@ Copyright (c) .NET Foundation. All rights reserved.
175176
PrivateAssets="all"
176177
ExcludeAssets="all" />
177178
</ItemGroup>
179+
180+
<!-- Add implicit package references that don't already exist in PackageReference. -->
181+
<Message Importance="High" Text="Sven was here" />
182+
<ItemGroup>
183+
<_ImplicitPackageReference Remove="@(PackageReference)" />
184+
<PackageReference Include="@(_ImplicitPackageReference)"
185+
IsImplicitlyDefined="true"
186+
PrivateAssets="all" />
187+
</ItemGroup>
178188
</Target>
179189

180190
<!--

0 commit comments

Comments
 (0)