diff --git a/eng/verify-nupkgs.ps1 b/eng/verify-nupkgs.ps1
index 67904b874b..99fd35d08f 100644
--- a/eng/verify-nupkgs.ps1
+++ b/eng/verify-nupkgs.ps1
@@ -21,7 +21,7 @@ function Confirm-NugetPackages {
$expectedNumOfFiles = @{
"MSTest.Sdk" = 16
"MSTest.TestFramework" = 105
- "MSTest.TestAdapter" = 76
+ "MSTest.TestAdapter" = 66
"MSTest.Extensions.Hosting" = 57
"MSTest" = 10
"MSTest.Analyzers" = 56
diff --git a/src/Adapter/MSTest.TestAdapter/MSTest.TestAdapter.csproj b/src/Adapter/MSTest.TestAdapter/MSTest.TestAdapter.csproj
index 7cc4ba1299..3143f086e6 100644
--- a/src/Adapter/MSTest.TestAdapter/MSTest.TestAdapter.csproj
+++ b/src/Adapter/MSTest.TestAdapter/MSTest.TestAdapter.csproj
@@ -73,10 +73,16 @@ $(CommonProductDescription)]]>
-
+
+
+ none
+
-
+
+ none
+
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Adapter/MSTest.TestAdapter/PACKAGE.md b/src/Adapter/MSTest.TestAdapter/PACKAGE.md
index b4f0970840..ee8c908e97 100644
--- a/src/Adapter/MSTest.TestAdapter/PACKAGE.md
+++ b/src/Adapter/MSTest.TestAdapter/PACKAGE.md
@@ -28,6 +28,14 @@ Supported platforms:
- UWP 10.0.16299
- UWP 10.0.17763 with .NET 10+
+## Classic UWP dependencies
+
+The classic UWP adapter payload contains the adapter and its platform-services
+assembly. Microsoft.Testing.Platform and its extensions are restored from their
+own NuGet packages rather than duplicated inside this package. The classic UWP
+bootstrap also depends on the TRX reporting and Retry packages. The adapter's
+build targets include the resolved runtime assemblies in the AppX deployment.
+
## F# modules
F# modules can contain test functions without a `[]` attribute:
diff --git a/src/Adapter/MSTest.TestAdapter/buildTransitive/uwp/MSTest.TestAdapter.targets b/src/Adapter/MSTest.TestAdapter/buildTransitive/uwp/MSTest.TestAdapter.targets
index f186a182ee..5c96cf2b87 100644
--- a/src/Adapter/MSTest.TestAdapter/buildTransitive/uwp/MSTest.TestAdapter.targets
+++ b/src/Adapter/MSTest.TestAdapter/buildTransitive/uwp/MSTest.TestAdapter.targets
@@ -17,38 +17,29 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ <_MSTestUwpRuntimeDependency Include="@(RuntimeCopyLocalItems)" Condition=" '$(UsingMicrosoftNETSdk)' == 'true' " />
+ <_MSTestUwpRuntimeDependency Include="@(ReferencePath)" Condition=" '$(UsingMicrosoftNETSdk)' != 'true' " />
+
+ %(_MSTestUwpRuntimeDependency.Filename)%(_MSTestUwpRuntimeDependency.Extension)
+ PreserveNewest
+
+
+
diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ClassicUwpTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ClassicUwpTests.cs
index c234981f87..37c7fa9caa 100644
--- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ClassicUwpTests.cs
+++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ClassicUwpTests.cs
@@ -177,10 +177,25 @@ private static void AssertClassicUwpPackageLayout(UwpBuildResult build, string e
(string?)identity.Attribute("Name"),
$"Unexpected package identity in the tooling-generated manifest '{manifestPath}'.");
- string retryExtensionPath = Path.Combine(build.PackageLayoutPath, "Microsoft.Testing.Extensions.Retry.dll");
- Assert.IsTrue(
- File.Exists(retryExtensionPath),
- $"The classic UWP package layout does not contain the Retry runtime asset '{retryExtensionPath}'. " +
+ string[] runtimeAssemblies =
+ [
+ "Microsoft.ApplicationInsights.dll",
+ "Microsoft.Testing.Extensions.MSBuild.dll",
+ "Microsoft.Testing.Extensions.Retry.dll",
+ "Microsoft.Testing.Extensions.Telemetry.dll",
+ "Microsoft.Testing.Extensions.TrxReport.Abstractions.dll",
+ "Microsoft.Testing.Extensions.TrxReport.dll",
+ "Microsoft.Testing.Platform.dll",
+ "Microsoft.TestPlatform.CoreUtilities.dll",
+ "Microsoft.TestPlatform.PlatformAbstractions.dll",
+ "Microsoft.VisualStudio.TestPlatform.ObjectModel.dll",
+ ];
+ string[] missing = runtimeAssemblies
+ .Where(assembly => !File.Exists(Path.Combine(build.PackageLayoutPath, assembly)))
+ .ToArray();
+ Assert.IsEmpty(
+ missing,
+ $"The classic UWP package layout is missing runtime dependencies: {string.Join(", ", missing)}. " +
$"Recipe: '{build.RecipePath}'. Binlog: '{build.BinlogPath}'.");
}
diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/WindowsApplicationModelPackageTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/WindowsApplicationModelPackageTests.cs
index cafc10a6b3..d9b344af13 100644
--- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/WindowsApplicationModelPackageTests.cs
+++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/WindowsApplicationModelPackageTests.cs
@@ -194,9 +194,6 @@ public void PackedMSTestTestFramework_SealsConcreteUIAttributes(string assemblyP
// Classic UWP.
"build/uap10.0/MSTest.TestAdapter.props",
"build/uap10.0/MSTest.TestAdapter.targets",
- "buildTransitive/uap10.0/Microsoft.Testing.Extensions.TrxReport.Abstractions.dll",
- "buildTransitive/uap10.0/Microsoft.Testing.Extensions.Retry.dll",
- "buildTransitive/uap10.0/Microsoft.Testing.Platform.dll",
"buildTransitive/uap10.0/MSTest.TestAdapter.dll",
"buildTransitive/uap10.0/MSTestAdapter.PlatformServices.dll",
"buildTransitive/uap10.0/MSTest.TestAdapter.props",
@@ -243,6 +240,49 @@ public void PackedMSTestTestAdapter_ContainsRequiredWindowsApplicationModelAsset
GetExactCurrentPackagePath("MSTest.TestAdapter"),
RequiredTestAdapterEntries);
+ [TestMethod]
+ [OSCondition(OperatingSystems.Windows, IgnoreMessage = "Classic UWP package assets are produced only by Windows packs.")]
+ public void PackedMSTestTestAdapter_ClassicUwpDoesNotDuplicateRuntimeDependencies()
+ {
+ using ZipArchive archive = ZipFile.OpenRead(GetExactCurrentPackagePath("MSTest.TestAdapter"));
+ string[] assemblies = archive.Entries
+ .Select(entry => entry.FullName)
+ .Where(path => path.StartsWith("buildTransitive/uap10.0/", StringComparison.Ordinal)
+ && path.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
+ .Order(StringComparer.Ordinal)
+ .ToArray();
+
+ Assert.AreSequenceEqual(
+ [
+ "buildTransitive/uap10.0/MSTest.TestAdapter.dll",
+ "buildTransitive/uap10.0/MSTestAdapter.PlatformServices.dll",
+ ],
+ assemblies);
+ }
+
+ [TestMethod]
+ [DataRow("Microsoft.Testing.Extensions.TrxReport")]
+ [DataRow("Microsoft.Testing.Extensions.Retry")]
+ [OSCondition(OperatingSystems.Windows, IgnoreMessage = "Classic UWP package assets are produced only by Windows packs.")]
+ public void PackedMSTestTestAdapter_ClassicUwpDeclaresBootstrapDependencies(string packageId)
+ {
+ using ZipArchive archive = ZipFile.OpenRead(GetExactCurrentPackagePath("MSTest.TestAdapter"));
+ using var reader = new StreamReader(archive.GetEntry("MSTest.TestAdapter.nuspec")!.Open());
+ var nuspec = XDocument.Parse(reader.ReadToEnd());
+ XElement[] groups = nuspec.Descendants().Where(element => element.Name.LocalName == "group").ToArray();
+ XElement classicGroup = groups.Single(group => (string?)group.Attribute("targetFramework") == "UAP10.0.16299");
+ XElement dependency = Assert.ContainsSingle(
+ classicGroup.Elements().Where(element => (string?)element.Attribute("id") == packageId));
+
+ Assert.AreEqual(AcceptanceTestBase.MicrosoftTestingPlatformVersion, (string?)dependency.Attribute("version"));
+ Assert.IsEmpty(
+ groups.Where(group => group != classicGroup)
+ .SelectMany(group => group.Elements())
+ .Where(element => (string?)element.Attribute("id") == packageId)
+ .ToArray(),
+ $"The classic UWP bootstrap must not add '{packageId}' to other frameworks.");
+ }
+
[TestMethod]
[OSCondition(OperatingSystems.Windows, IgnoreMessage = "Windows application-model package assets are produced only by Windows packs.")]
public void PackedMSTestTestAdapter_UwpPropsRegisterMSTestBuilderHook()