Skip to content

Commit 10e515d

Browse files
committed
Fix tests now that package pruning is enabled by default
1 parent d4d0438 commit 10e515d

File tree

4 files changed

+8
-23
lines changed

4 files changed

+8
-23
lines changed

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ public static FrameworkPackages[] GetFrameworkPackages(NuGetFramework framework,
7777
{
7878
var frameworkPackages = new List<FrameworkPackages>();
7979

80-
if (frameworkReferences.Length == 0)
81-
{
82-
frameworkReferences = [DefaultFrameworkKey];
83-
}
84-
8580
foreach (var frameworkReference in frameworkReferences)
8681
{
8782
var frameworkKey = GetFrameworkKey(frameworkReference);

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ public void CompileConflictsAreNotRemovedFromRuntimeDepsAssets()
116116

117117
testProject.PackageReferences.Add(new TestPackageReference("Microsoft.AspNetCore.Mvc.Razor", "2.1.0"));
118118

119+
// This test relies on a package that would be pruned. This doesn't seem to be a customer scenario, it looks like it was
120+
// an easier way to test that files that were removed
121+
testProject.AdditionalProperties["RestoreEnablePackagePruning"] = "false";
122+
119123
var testAsset = _testAssetsManager.CreateTestProject(testProject);
120124

121125
var buildCommand = new BuildCommand(testAsset);

test/Microsoft.NET.Publish.Tests/GivenThatWeWantToStoreAProjectWithDependencies.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,6 @@ public void compose_dependencies()
7878
"fluentassertions.json/4.12.0/lib/netstandard1.3/FluentAssertions.Json.dll"
7979
};
8080

81-
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
82-
{
83-
// https://github.com/dotnet/core-setup/issues/2716 - an unintended native shim is getting published to the runtime store
84-
files_on_disk.Add($"runtime.{_runtimeRid}.runtime.native.system.security.cryptography/1.0.1/runtimes/{_runtimeRid}/native/System.Security.Cryptography.Native{FileConstants.DynamicLibSuffix}");
85-
}
86-
8781
storeDirectory.Should().OnlyHaveFiles(files_on_disk);
8882
}
8983

@@ -114,12 +108,6 @@ public void compose_dependencies_noopt()
114108
"fluentassertions.json/4.12.0/lib/netstandard1.3/FluentAssertions.Json.dll"
115109
};
116110

117-
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
118-
{
119-
// https://github.com/dotnet/core-setup/issues/2716 - an unintended native shim is getting published to the runtime store
120-
files_on_disk.Add($"runtime.{_runtimeRid}.runtime.native.system.security.cryptography/1.0.1/runtimes/{_runtimeRid}/native/System.Security.Cryptography.Native{FileConstants.DynamicLibSuffix}");
121-
}
122-
123111
storeDirectory.Should().OnlyHaveFiles(files_on_disk);
124112
}
125113

@@ -157,12 +145,6 @@ public void compose_multifile()
157145
"fluentassertions.json/4.12.0/lib/netstandard1.3/FluentAssertions.Json.dll",
158146
};
159147

160-
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
161-
{
162-
// https://github.com/dotnet/core-setup/issues/2716 - an unintended native shim is getting published to the runtime store
163-
files_on_disk.Add($"runtime.{_runtimeRid}.runtime.native.system.security.cryptography/1.0.1/runtimes/{_runtimeRid}/native/System.Security.Cryptography.Native{FileConstants.DynamicLibSuffix}");
164-
}
165-
166148
storeDirectory.Should().OnlyHaveFiles(files_on_disk);
167149

168150
var knownpackage = new HashSet<PackageIdentity>

test/dotnet-list-package.Tests/GivenDotnetListPackage.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ public static void Main(string[] args)
179179
};
180180

181181
testProject.PackageReferences.Add(new TestPackageReference("NewtonSoft.Json", "9.0.1"));
182+
183+
// Disable package pruning so that there are still transitive dependencies to test the command
184+
testProject.AdditionalProperties["RestoreEnablePackagePruning"] = "false";
185+
182186
var testAsset = _testAssetsManager.CreateTestProject(testProject);
183187
var projectDirectory = Path.Combine(testAsset.Path, testProject.Name);
184188

0 commit comments

Comments
 (0)