Skip to content

Commit 93ea2a0

Browse files
Youssef1313nohwndgewarren
authored
Document MTP v1 to v2 migration (#48673)
* Document MTP v1 to v2 migration * markdownlint * Apply suggestions from code review Co-authored-by: Jakub Jareš <[email protected]> Co-authored-by: Genevieve Warren <[email protected]> * Consistency * xref * More xrefs * Clarify * Cleanup * Fix markdownlint * Update docs/core/testing/microsoft-testing-platform-migration-from-v1-to-v2.md Co-authored-by: Jakub Jareš <[email protected]> * Apply suggestions from code review Co-authored-by: Genevieve Warren <[email protected]> --------- Co-authored-by: Jakub Jareš <[email protected]> Co-authored-by: Genevieve Warren <[email protected]>
1 parent e4d5897 commit 93ea2a0

File tree

3 files changed

+76
-3
lines changed

3 files changed

+76
-3
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
title: Migrating from Microsoft.Testing.Platform v1 to v2
3+
description: Learn how to migrate to Microsoft.Testing.Platform v2 and understand the key changes.
4+
author: Youssef1313
5+
ms.author: ygerges
6+
ms.date: 10/08/2025
7+
---
8+
9+
# Mirate from Microsoft.Testing.Platform v1 to v2
10+
11+
The stable version Microsoft.Testing.Platform v2 is now available. This migration guide explores what's changed in Microsoft.Testing.Platform v2 and how you can migrate to this version.
12+
13+
## Source breaking changes
14+
15+
These are breaking changes that might cause build errors after migration.
16+
17+
### Dropped unsupported target frameworks
18+
19+
Support for target frameworks from .NET Core 3.1 to .NET 7 is dropped. The minimum supported .NET version is .NET 8.
20+
This change doesn't affect .NET Framework. .NET Framework 4.6.2 continues to be the minimum supported .NET Framework target.
21+
22+
### Removed obsolete types
23+
24+
The following types were marked obsolete in MTP v1. In MTP v2, they are removed completely:
25+
26+
- `ITestApplicationLifecycleCallbacks`: use `ITestHostApplicationLifetime` instead.
27+
- `TestNodeFileArtifact`: use `FileArtifactProperty` instead.
28+
- `KeyValuePairStringProperty`: use `TestMetadataProperty` instead.
29+
- `TestSessionContext.Client`: use `IClientInfo` instead.
30+
31+
This breaking change doesn't affect typical users of test frameworks. It only affects test framework authors and extension authors.
32+
33+
### API signature changes
34+
35+
- A `CancellationToken` parameter was added to <xref:Microsoft.Testing.Platform.OutputDevice.IOutputDevice.DisplayAsync(Microsoft.Testing.Platform.Extensions.OutputDevice.IOutputDeviceDataProducer,Microsoft.Testing.Platform.OutputDevice.IOutputDeviceData)?displayProperty=nameWithType>.
36+
- Methods in <xref:Microsoft.Testing.Platform.Extensions.TestHost.ITestSessionLifetimeHandler> interface are changed to have an `ITestSessionContext` parameter instead of both <xref:Microsoft.Testing.Platform.TestHost.SessionUid> and <xref:System.Threading.CancellationToken> parameters.
37+
- `IDataConsumer` is moved from `Microsoft.Testing.Platform.Extensions.TestHost` namespace to `Microsoft.Testing.Platform.Extensions`.
38+
39+
This breaking change doesn't affect typical users of test frameworks. It only affects test framework authors and extension authors.
40+
41+
## Behavior breaking changes
42+
43+
These are breaking changes that might affect the behavior at run time.
44+
45+
### Compatibility with VSTest-based `dotnet test`
46+
47+
The `dotnet test` command has two implementations:
48+
49+
- VSTest-based implementation: this was the only implementation up to .NET 9 SDK.
50+
- MTP-based implementation: this was added starting in .NET 10 SDK.
51+
52+
Running MTP test projects with .NET 10 SDK now requires opting-in to the MTP-based `dotnet test` and can no longer be run with the VSTest-based implementation, which was previously enabled by `TestingPlatformDotnetTestSupport` MSBuild property in MTP v1.
53+
54+
To opt-in the MTP-based implementation, create global.json in repository or solution root (or update existing global.json if you have one already), to have test runner set as Microsoft.Testing.Platform, as shown in the following example:
55+
56+
```json
57+
{
58+
"test": {
59+
"runner": "Microsoft.Testing.Platform"
60+
}
61+
}
62+
```
63+
64+
Attempting to run the VSTest-based `dotnet test` with MTP v2 will produce the following error:
65+
66+
> Testing with VSTest target is no longer supported by Microsoft.Testing.Platform on .NET 10 SDK and later. If you use dotnet test, you should opt-in to the new dotnet test experience. For more information, see <https://aka.ms/dotnet-test-mtp-error>
67+
68+
### Rename of command-line options
69+
70+
- The `--diagnostic-output-fileprefix` command-line option was renamed to `--diagnostic-file-prefix`.
71+
- The `--diagnostic-filelogger-synchronouswrite` command-line option was renamed to `--diagnostic-synchronous-write`.

docs/core/testing/unit-testing-mstest-migration-v3-v4.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.author: ygerges
66
ms.date: 07/22/2025
77
---
88

9-
# Migrate from MSTest v3 to MSTest v4
9+
# Migrate from MSTest v3 to v4
1010

1111
The stable version MSTest v4 is now available. This migration guide explores what's changed in MSTest v4 and how you can migrate to this version.
1212

docs/navigate/devops-testing/toc.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,14 @@ items:
7171
items:
7272
- name: Overview
7373
href: ../../core/testing/unit-testing-mstest-intro.md
74-
- name: Migrate MSTest from v1 to v3
74+
- name: Migrate from MSTest v1 to v3
7575
href: ../../core/testing/unit-testing-mstest-migration-from-v1-to-v3.md
76-
- name: Migrate from MSTest v3 to MSTest v4
76+
- name: Migrate from MSTest v3 to v4
7777
href: ../../core/testing/unit-testing-mstest-migration-v3-v4.md
7878
- name: Microsoft.Testing.Platform support (MSTest runner)
7979
href: ../../core/testing/unit-testing-mstest-runner-intro.md
80+
- name: Migrate from Microsoft.Testing.Platform v1 to v2
81+
href: ../../core/testing/microsoft-testing-platform-migration-from-v1-to-v2.md
8082
- name: Getting started
8183
items:
8284
- name: Overview

0 commit comments

Comments
 (0)