|
| 1 | +--- |
| 2 | +title: Microsoft.Testing.Platform migration from v1 to v2 |
| 3 | +description: Learn about migrating to Microsoft.Testing.Platform v2. |
| 4 | +author: Youssef1313 |
| 5 | +ms.author: ygerges |
| 6 | +ms.date: 09/23/2025 |
| 7 | +--- |
| 8 | + |
| 9 | +# Migrate from Microsoft.Testing.Platform v1 to Microsoft.Testing.Platform v2 |
| 10 | + |
| 11 | +The preview 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 .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 | +### Remove obsolete types |
| 23 | + |
| 24 | +The following types were marked obsolete in MTP v1. In MTP v2, they are now removed: |
| 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 `IOutputDevice.DisplayAsync`. |
| 36 | +- Methods in `ITestSessionLifetimeHandler` interface are changed to have a `ITestSessionContext` parameter instead of both `SessionUid` and `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 | +1. VSTest-based implementation: this was the only implementation up to .NET 9 SDK. |
| 50 | +2. 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 | +### Rename of command-line options |
| 55 | + |
| 56 | +- The `--diagnostic-output-fileprefix` command-line option was renamed to `--diagnostic-file-prefix`. |
| 57 | +- The `--diagnostic-filelogger-synchronouswrite` command-line option was renamed to `--diagnostic-synchronous-write`. |
0 commit comments