Skip to content

Commit 3cbe09a

Browse files
Exclude Microsoft.Extensions.FileProviders.Embedded from pruning (#63898)
1 parent ecd06a3 commit 3cbe09a

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/Framework/App.Ref/src/Microsoft.AspNetCore.App.Ref.sfxproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,13 @@
173173

174174
<!-- Include Microsoft.AspNetCore.App for Package Pruning -->
175175
<_AspNetCoreAppPackageOverrides Include="$(SharedFrameworkName)|$(ReferencePackSharedFxVersion)" />
176+
177+
<!--
178+
Exclude Microsoft.Extensions.FileProviders.Embedded from pruning because it contains build logic
179+
required to generate the embedded files manifest. The package's build targets are not in the SDK,
180+
so they must be available from the package itself. See https://github.com/dotnet/aspnetcore/issues/63719
181+
-->
182+
<_AspNetCoreAppPackageOverrides Remove="Microsoft.Extensions.FileProviders.Embedded|$(ReferencePackSharedFxVersion)" />
176183
</ItemGroup>
177184

178185
<WriteLinesToFile

src/Framework/test/TargetingPackTests.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,25 @@ public void PackageOverridesContainsCorrectEntries()
144144
.Split(';', StringSplitOptions.RemoveEmptyEntries)
145145
.ToHashSet();
146146

147-
// PackageOverrides will contain all Aspnetcore/Runtime ref pack libs, plus an entry for Microsoft.AspNetCore.App
147+
// Some packages are excluded from pruning because they contain build logic that is not in the SDK.
148+
// These packages need their build targets to execute even though their runtime assemblies are in the shared framework.
149+
string[] packagesExcludedFromPruning = ["Microsoft.Extensions.FileProviders.Embedded"]; // See https://github.com/dotnet/aspnetcore/issues/63719
150+
151+
foreach (var excludedPackage in packagesExcludedFromPruning)
152+
{
153+
aspnetcoreDependencies.Remove(excludedPackage);
154+
}
155+
156+
// PackageOverrides will contain all Aspnetcore/Runtime ref pack libs, plus an entry for Microsoft.AspNetCore.App,
157+
// minus any packages excluded from pruning
148158
Assert.Equal(packageOverrideFileLines.Length, runtimeDependencies.Count + aspnetcoreDependencies.Count + 1);
149159

160+
// Verify that excluded packages are NOT in PackageOverrides
161+
foreach (var excludedPackage in packagesExcludedFromPruning)
162+
{
163+
Assert.DoesNotContain(packageOverrideFileLines, line => line.StartsWith(excludedPackage + "|", StringComparison.Ordinal));
164+
}
165+
150166
// PackageOverrides versions should remain at Major.Minor.0 while servicing.
151167
var netCoreAppPackageVersion = TestData.GetMicrosoftNETCoreAppVersion();
152168
Assert.True(

0 commit comments

Comments
 (0)