Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 66 additions & 1 deletion docs/decisions/mstest-adapter-lib-assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@
| Package | Ordinary assets | UI payload (not in `lib`) | Selected by |
| --- | --- | --- | --- |
| `MSTest.TestFramework` | `lib/{net462,netstandard2.0,net10.0,net11.0,uap10.0.16299}` | `buildTransitive/net10.0/{uwp,winui}/` (`MSTest.Uwp.dll`, `MSTest.WinUI.dll` with xml, pri and WinUI satellites) | Modern UI projects get compile and runtime assets according to the resolved core framework assets. For classic UWP, NuGet selects `lib/uap10.0.16299` directly. |
| `MSTest.TestAdapter` | `lib/{net462,net10.0,net11.0}` | `buildTransitive/net10.0/ui/` (UI adapter and platform services); `buildTransitive/uap10.0/` (classic UWP adapter, platform services and `_localization` satellites) | `_MSTestComputeUIAdapterSelection` decides; `_MSTestSelectUIAdapterAssets` then swaps the resolved `lib/net10.0` adapter DLLs for the `ui/` build in place after `ResolvePackageAssets` (and the publish equivalent); classic UWP references the `uap10.0` payload directly |
| `MSTest.TestAdapter` | `lib/{net462,net10.0,net11.0,uap10.0.16299}` | `buildTransitive/net10.0/` (UI adapter and platform services) | `_MSTestComputeUIAdapterSelection` decides; `_MSTestSelectUIAdapterAssets` then swaps the resolved `lib/net10.0` adapter DLLs for the `buildTransitive/net10.0` build in place after `ResolvePackageAssets` (and the publish equivalent); for classic UWP, NuGet selects `lib/uap10.0.16299` directly (see [classic UWP lib layout](#classic-uwp-adapter-in-lib-and-flat-ui-payload)) |

Classic UWP has a distinct TFM. Its `lib` group includes `MSTest.Uwp` alongside
the same core framework, type forwarders and satellites as `lib/netstandard2.0`:
Expand Down Expand Up @@ -1648,3 +1648,68 @@
build/publish probes, not an additional native activation case. Linux/Bazel
packs and unrelated application-model cases were not rerun. These local
results do not replace fresh blocking CI checks on the published head.

## Classic UWP adapter in lib and flat UI payload

Date: 2026-11-24

### Request

The maintainer asked to drop the `ui` subfolder from the net10 Windows UI
adapter payload, and to ship the classic UWP adapter directly from `lib`
because `uap10.0` is a real NuGet TFM.

### Decision

- The Windows-specific UWP/WinUI adapter build moves from
`buildTransitive/net10.0/ui/` to `buildTransitive/net10.0/`. The
portable net10 adapter stays in `lib/net10.0`, so these two builds do not
collide. `buildTransitive/common/MSTest.TestAdapter.targets` selects the
flat path through `_MSTestUIAdapterRoot`.
- The classic UWP adapter DLLs and satellites move from the
`buildTransitive/uap10.0` payload to `lib/uap10.0.16299/`, matching
`MSTest.TestFramework`. Only the props, targets and `Parallelize.targets`
remain under `buildTransitive/uap10.0/`.
- The UWP targets drop their explicit `Reference`/`HintPath` items. The
`_AddMSTestUwpRuntimeDependencies` AppX `Content` items still deploy the
adapter DLLs, because SDK-style classic UWP projects do not copy NuGet
runtime assets into the AppX layout. Satellite globs read
`lib/uap10.0.16299/<culture>/`, so the existing culture policy is
unchanged.

### Consequences

- NuGet now produces a `uap10.0.16299` `<references>` group with
`MSTest.TestAdapter.dll` and `MSTestAdapter.PlatformServices.dll`. Classic
UWP projects therefore get a compile reference to the adapter, as net462
and net10 consumers already do. Adapter types are mostly internal, so this
was accepted for consistency. Previously the adapter used a
`Private=false` reference with no compile surface.
- Alternative considered: keep the classic UWP DLLs in a `buildTransitive`
payload or keep satellites under `_localization`. It was rejected because
it keeps a parallel, nonstandard asset location for a TFM that NuGet
already understands.

### Validation

- `.\build.cmd -pack` and `.\eng\verify-nupkgs.ps1 -configuration Debug
-updateBaselines`: only `eng/package-shapes/MSTest.TestAdapter.txt`
changed.
- MSTest acceptance tests run with `TESTFX_RUN_WINDOWS_APP_MODEL_TESTS=1`:
`WindowsApplicationModelPackageTests`, `CoreFrameworkAssemblyTests`,
`ClassicUwpTests` and `SdkTests` (including the classic UWP, Modern UWP
and WinUI composition and satellite cases): 191 passed, 0 failed, including
end-to-end classic UWP MTP runs for the `MSTest`, `MSTest.Sdk` and
`MSTest.TestAdapter` consumers and classic UWP satellite filtering.
- MTP `PackagedWinUITests` built the WinUI consumers against the flat
payload but could not run locally: the native cases need
`TESTFX_DOTNET_10_PATH`, and the controller cases failed to load
`Microsoft.CodeCoverage.Instrumentation.Core` from the unchanged
`Microsoft.Testing.Extensions.PackagedApp.MSBuild` controller layout.
CI must cover them.

### Gap

Non-SDK (`packages.config`) classic UWP projects were not exercised. They
may receive adapter satellites from both NuGet and the culture-policy
`Content` items.

Check failure on line 1715 in docs/decisions/mstest-adapter-lib-assets.md

View workflow job for this annotation

GitHub Actions / lint

Files should end with a single newline character

docs/decisions/mstest-adapter-lib-assets.md:1715:16 MD047/single-trailing-newline Files should end with a single newline character https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md047.md
60 changes: 30 additions & 30 deletions eng/package-shapes/MSTest.TestAdapter.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,20 @@ build/net462/MSTest.TestAdapter.props
build/net462/MSTest.TestAdapter.targets
build/uap10.0/MSTest.TestAdapter.props
build/uap10.0/MSTest.TestAdapter.targets
buildTransitive/net10.0/MSTest.TestAdapter.dll
buildTransitive/net10.0/MSTest.TestAdapter.props
buildTransitive/net10.0/MSTest.TestAdapter.targets
buildTransitive/net10.0/MSTestAdapter.PlatformServices.dll
buildTransitive/net10.0/Parallelize.targets
buildTransitive/net10.0/ui/MSTest.TestAdapter.dll
buildTransitive/net10.0/ui/MSTestAdapter.PlatformServices.dll
buildTransitive/net11.0/MSTest.TestAdapter.props
buildTransitive/net11.0/MSTest.TestAdapter.targets
buildTransitive/net11.0/Parallelize.targets
buildTransitive/net462/MSTest.TestAdapter.props
buildTransitive/net462/MSTest.TestAdapter.targets
buildTransitive/net462/Parallelize.targets
buildTransitive/uap10.0/MSTest.TestAdapter.dll
buildTransitive/uap10.0/MSTest.TestAdapter.props
buildTransitive/uap10.0/MSTest.TestAdapter.targets
buildTransitive/uap10.0/MSTestAdapter.PlatformServices.dll
buildTransitive/uap10.0/Parallelize.targets
buildTransitive/uap10.0/_localization/cs/MSTest.TestAdapter.resources.dll
buildTransitive/uap10.0/_localization/cs/MSTestAdapter.PlatformServices.resources.dll
buildTransitive/uap10.0/_localization/de/MSTest.TestAdapter.resources.dll
buildTransitive/uap10.0/_localization/de/MSTestAdapter.PlatformServices.resources.dll
buildTransitive/uap10.0/_localization/es/MSTest.TestAdapter.resources.dll
buildTransitive/uap10.0/_localization/es/MSTestAdapter.PlatformServices.resources.dll
buildTransitive/uap10.0/_localization/fr/MSTest.TestAdapter.resources.dll
buildTransitive/uap10.0/_localization/fr/MSTestAdapter.PlatformServices.resources.dll
buildTransitive/uap10.0/_localization/it/MSTest.TestAdapter.resources.dll
buildTransitive/uap10.0/_localization/it/MSTestAdapter.PlatformServices.resources.dll
buildTransitive/uap10.0/_localization/ja/MSTest.TestAdapter.resources.dll
buildTransitive/uap10.0/_localization/ja/MSTestAdapter.PlatformServices.resources.dll
buildTransitive/uap10.0/_localization/ko/MSTest.TestAdapter.resources.dll
buildTransitive/uap10.0/_localization/ko/MSTestAdapter.PlatformServices.resources.dll
buildTransitive/uap10.0/_localization/pl/MSTest.TestAdapter.resources.dll
buildTransitive/uap10.0/_localization/pl/MSTestAdapter.PlatformServices.resources.dll
buildTransitive/uap10.0/_localization/pt-BR/MSTest.TestAdapter.resources.dll
buildTransitive/uap10.0/_localization/pt-BR/MSTestAdapter.PlatformServices.resources.dll
buildTransitive/uap10.0/_localization/ru/MSTest.TestAdapter.resources.dll
buildTransitive/uap10.0/_localization/ru/MSTestAdapter.PlatformServices.resources.dll
buildTransitive/uap10.0/_localization/tr/MSTest.TestAdapter.resources.dll
buildTransitive/uap10.0/_localization/tr/MSTestAdapter.PlatformServices.resources.dll
buildTransitive/uap10.0/_localization/zh-Hans/MSTest.TestAdapter.resources.dll
buildTransitive/uap10.0/_localization/zh-Hans/MSTestAdapter.PlatformServices.resources.dll
buildTransitive/uap10.0/_localization/zh-Hant/MSTest.TestAdapter.resources.dll
buildTransitive/uap10.0/_localization/zh-Hant/MSTestAdapter.PlatformServices.resources.dll
lib/net10.0/MSTest.TestAdapter.dll
lib/net10.0/MSTestAdapter.PlatformServices.dll
lib/net10.0/cs/MSTest.TestAdapter.resources.dll
Expand Down Expand Up @@ -140,4 +112,32 @@ lib/net462/zh-Hans/MSTest.TestAdapter.resources.dll
lib/net462/zh-Hans/MSTestAdapter.PlatformServices.resources.dll
lib/net462/zh-Hant/MSTest.TestAdapter.resources.dll
lib/net462/zh-Hant/MSTestAdapter.PlatformServices.resources.dll
lib/uap10.0.16299/MSTest.TestAdapter.dll
lib/uap10.0.16299/MSTestAdapter.PlatformServices.dll
lib/uap10.0.16299/cs/MSTest.TestAdapter.resources.dll
lib/uap10.0.16299/cs/MSTestAdapter.PlatformServices.resources.dll
lib/uap10.0.16299/de/MSTest.TestAdapter.resources.dll
lib/uap10.0.16299/de/MSTestAdapter.PlatformServices.resources.dll
lib/uap10.0.16299/es/MSTest.TestAdapter.resources.dll
lib/uap10.0.16299/es/MSTestAdapter.PlatformServices.resources.dll
lib/uap10.0.16299/fr/MSTest.TestAdapter.resources.dll
lib/uap10.0.16299/fr/MSTestAdapter.PlatformServices.resources.dll
lib/uap10.0.16299/it/MSTest.TestAdapter.resources.dll
lib/uap10.0.16299/it/MSTestAdapter.PlatformServices.resources.dll
lib/uap10.0.16299/ja/MSTest.TestAdapter.resources.dll
lib/uap10.0.16299/ja/MSTestAdapter.PlatformServices.resources.dll
lib/uap10.0.16299/ko/MSTest.TestAdapter.resources.dll
lib/uap10.0.16299/ko/MSTestAdapter.PlatformServices.resources.dll
lib/uap10.0.16299/pl/MSTest.TestAdapter.resources.dll
lib/uap10.0.16299/pl/MSTestAdapter.PlatformServices.resources.dll
lib/uap10.0.16299/pt-BR/MSTest.TestAdapter.resources.dll
lib/uap10.0.16299/pt-BR/MSTestAdapter.PlatformServices.resources.dll
lib/uap10.0.16299/ru/MSTest.TestAdapter.resources.dll
lib/uap10.0.16299/ru/MSTestAdapter.PlatformServices.resources.dll
lib/uap10.0.16299/tr/MSTest.TestAdapter.resources.dll
lib/uap10.0.16299/tr/MSTestAdapter.PlatformServices.resources.dll
lib/uap10.0.16299/zh-Hans/MSTest.TestAdapter.resources.dll
lib/uap10.0.16299/zh-Hans/MSTestAdapter.PlatformServices.resources.dll
lib/uap10.0.16299/zh-Hant/MSTest.TestAdapter.resources.dll
lib/uap10.0.16299/zh-Hant/MSTestAdapter.PlatformServices.resources.dll
package/services/metadata/core-properties/{guid}.psmdcp
26 changes: 14 additions & 12 deletions src/MSTest/MSTest.TestAdapter/MSTest.TestAdapter.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project>
<Project>

<PropertyGroup>
<_UsesMSBuildSdkExtras Condition=" '$(OS)' == 'Windows_NT' ">true</_UsesMSBuildSdkExtras>
Expand All @@ -22,7 +22,8 @@
<IsPackable>true</IsPackable>
<!--
This package has a custom layout (the adapter and the bundled PlatformServices assemblies ship as lib/<tfm>
assets, the UWP/WinUI variants ship as build-time payloads under buildTransitive/, and the dependencies are
assets, including classic UWP under lib/uap10.0.16299, the Windows-specific modern UWP/WinUI adapter ships as
a build-time payload under buildTransitive/net10.0, and the dependencies are
curated), so the package contents and dependencies are produced explicitly through MSBuild items/targets
rather than the default SDK output.
-->
Expand All @@ -38,7 +39,7 @@ Supported platforms:
- UWP and WinUI with .NET 10.0 Windows 10.0.18362+

$(CommonProductDescription)]]></PackageDescription>
<!-- UWP/WinUI adapter assemblies are build-time payloads selected by the package targets, not lib assets. -->
<!-- The modern UWP/WinUI adapter assemblies are a build-time payload selected by the package targets, not lib assets. -->
<NoWarn>$(NoWarn);NU5100;NU5128</NoWarn>

<GenerateBuildInfo>true</GenerateBuildInfo>
Expand Down Expand Up @@ -189,21 +190,22 @@ $(CommonProductDescription)]]></PackageDescription>
</Target>

<!--
Classic UWP (uap10.0) consumes the adapter as a build-time payload, as before the lib-asset layout: the
buildTransitive/uap10.0 targets reference it explicitly and deploy its dependencies through AppX content.
Classic UWP consumes the adapter as standard lib/uap10.0.16299 assets (satellites under lib/uap10.0.16299/<culture>/),
like MSTest.TestFramework. The buildTransitive/uap10.0 targets deploy it and its dependencies through AppX content
because SDK-style UWP does not copy NuGet runtime assets.
-->
<Target Name="_AddClassicUwpTestAdapterPackageFiles" DependsOnTargets="BuildOnlySettings;ResolveReferences"
Condition=" '$(TargetFramework)' == '$(UwpMinimum)' AND '$(UwpMinimum)' != '' ">
<ItemGroup>
<TfmSpecificPackageFile Include="$(TargetDir)MSTest.TestAdapter.dll" PackagePath="buildTransitive\uap10.0\" />
<TfmSpecificPackageFile Include="$(TargetDir)MSTestAdapter.PlatformServices.dll" PackagePath="buildTransitive\uap10.0\" />
<TfmSpecificPackageFile Include="$(TargetDir)MSTest.TestAdapter.dll" PackagePath="lib\$(UwpMinimum)\" />
<TfmSpecificPackageFile Include="$(TargetDir)MSTestAdapter.PlatformServices.dll" PackagePath="lib\$(UwpMinimum)\" />
Comment thread
Evangelink marked this conversation as resolved.
Resolved
<TfmSpecificPackageFile Include="$(MSBuildProjectDirectory)\buildTransitive\uwp\MSTest.TestAdapter.props" PackagePath="buildTransitive\uap10.0\" />
<TfmSpecificPackageFile Include="$(MSBuildProjectDirectory)\buildTransitive\uwp\MSTest.TestAdapter.targets" PackagePath="buildTransitive\uap10.0\" />
<TfmSpecificPackageFile Include="$(MSBuildProjectDirectory)\buildTransitive\Parallelize.targets" PackagePath="buildTransitive\uap10.0\" />

<!-- Localized satellites, packed under buildTransitive/uap10.0/_localization/<culture>/. -->
<TfmSpecificPackageFile Include="$(TargetDir)**\MSTestAdapter.PlatformServices.resources.dll" PackagePath="buildTransitive\uap10.0\_localization\" />
<TfmSpecificPackageFile Include="$(TargetDir)**\MSTest.TestAdapter.resources.dll" PackagePath="buildTransitive\uap10.0\_localization\" />
<!-- Localized satellites, packed under lib/uap10.0.16299/<culture>/ (the culture folder comes from RecursiveDir). -->
<TfmSpecificPackageFile Include="$(TargetDir)**\MSTestAdapter.PlatformServices.resources.dll" PackagePath="lib\$(UwpMinimum)\" />
<TfmSpecificPackageFile Include="$(TargetDir)**\MSTest.TestAdapter.resources.dll" PackagePath="lib\$(UwpMinimum)\" />
</ItemGroup>
</Target>

Expand All @@ -220,8 +222,8 @@ $(CommonProductDescription)]]></PackageDescription>
<Error Condition=" !Exists('$(_MSTestUITestAdapterOutput)MSTest.TestAdapter.dll') or !Exists('$(_MSTestUITestAdapterOutput)MSTestAdapter.PlatformServices.dll') "
Text="Build MSTest.TestAdapter for $(WinUiMinimum) before packing MSTest.TestAdapter. Use the repository solution build and pack entry point." />
<ItemGroup>
<TfmSpecificPackageFile Include="$(_MSTestUITestAdapterOutput)MSTest.TestAdapter.dll" PackagePath="buildTransitive\net10.0\ui\" />
<TfmSpecificPackageFile Include="$(_MSTestUITestAdapterOutput)MSTestAdapter.PlatformServices.dll" PackagePath="buildTransitive\net10.0\ui\" />
<TfmSpecificPackageFile Include="$(_MSTestUITestAdapterOutput)MSTest.TestAdapter.dll" PackagePath="buildTransitive\net10.0\" />
<TfmSpecificPackageFile Include="$(_MSTestUITestAdapterOutput)MSTestAdapter.PlatformServices.dll" PackagePath="buildTransitive\net10.0\" />
</ItemGroup>
</Target>

Expand Down
6 changes: 3 additions & 3 deletions src/MSTest/MSTest.TestAdapter/PACKAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ Supported platforms:
UWP and WinUI applications use the same `MSTest.TestAdapter` and `MSTest.TestFramework`
packages. For modern UWP and WinUI projects (`UseUwp`/`UseUwpTools` or `UseWinUI` on a
.NET Windows target), the package build targets replace the ordinary `lib/net10.0`
adapter with the Windows-specific build shipped under `buildTransitive/net10.0/ui`.
Classic UWP (`uap10.0`) projects reference the adapter shipped under
`buildTransitive/uap10.0`. Shared test libraries only need `MSTest.TestFramework`;
adapter with the Windows-specific build shipped under `buildTransitive/net10.0`.
Classic UWP (`uap10.0`) projects reference the adapter shipped as a standard
`lib/uap10.0.16299` asset. Shared test libraries only need `MSTest.TestFramework`;
reference `MSTest.TestAdapter` from the test application.

## Package assets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<!--
WinUI and modern (.NET) UWP applications need the UI build of the adapter, which dispatches [UITestMethod] to the
application's UI thread. NuGet can only select one lib/<tfm> asset per target framework, so that build ships in
buildTransitive/net10.0/ui and replaces the adapter assemblies NuGet resolved from lib (see _MSTestSelectUIAdapterAssets).
buildTransitive/net10.0 and replaces the adapter assemblies NuGet resolved from lib (see _MSTestSelectUIAdapterAssets).
The selection runs at execution time because UseWinUI, UseUwpTools and UseUwp may be set after package targets are
imported (for example in Directory.Build.targets).
-->
Expand All @@ -27,7 +27,7 @@
<_MSTestUIAdapterSelected Condition=" '$(UsingMicrosoftNETSdk)' == 'true'
AND '$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND '$(TargetPlatformIdentifier)' == 'Windows'
AND ('$(UseWinUI)' == 'true' OR '$(UseUwpTools)' == 'true' OR ('$(UseUwp)' == 'true' AND '$(UseUwpTools)' == '')) ">true</_MSTestUIAdapterSelected>
<_MSTestUIAdapterRoot>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', '..', 'net10.0', 'ui'))</_MSTestUIAdapterRoot>
<_MSTestUIAdapterRoot>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', '..', 'net10.0'))</_MSTestUIAdapterRoot>
</PropertyGroup>
</Target>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<Project>

<!-- Classic UWP consumes the adapter from buildTransitive/uap10.0 instead of lib/uap10.0 so the payload
is referenced explicitly and deployed through the AppX content pipeline. -->
<!-- Classic UWP resolves the adapter from lib/uap10.0.16299. These targets only deploy it through the AppX
content pipeline and apply the adapter's satellite culture policy. -->
<PropertyGroup>
<_MSTestAdapterPayloadRoot>$(MSBuildThisFileDirectory)</_MSTestAdapterPayloadRoot>
<_MSTestAdapterLocalizationRoot>$(MSBuildThisFileDirectory)_localization\</_MSTestAdapterLocalizationRoot>
<_MSTestAdapterLocalizationRoot>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', '..', '..', 'lib', 'uap10.0.16299'))</_MSTestAdapterLocalizationRoot>
<EnableMSTestV2CopyResources Condition=" '$(EnableMSTestV2CopyResources)' == '' ">true</EnableMSTestV2CopyResources>
<IsMSTestTestAdapterReferenced>true</IsMSTestTestAdapterReferenced>
</PropertyGroup>
Expand Down
Loading
Loading