Today, I spent quite some time migrating a .NET 10 test project from VSTest to Microsoft.Testing.Platform (MTP).
In the hope of helping others, I’ll describe below the reason for the migration as well as how I was able to resolve various errors and issues that occurred during the migration process.
The Why
After updating the NuGet packages of a .NET 10 test project, the Azure DevOps CI/CD pipeline task that runs the tests started failing with the following error message.
/home/vsts/.nuget/packages/microsoft.testing.platform.msbuild/2.3.3/buildMultiTargeting/Microsoft.Testing.Platform.MSBuild.targets(320,5): error : 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
The trigger for the tests to fail was the update of the NuGet package xunit.v3 from version 3.2.2 to version 4.0.0. (see here for the release notes).

When running the tests in Visual Studio 2026, they succeeded. However, in the Azure DevOps pipeline they failed.
Azure DevOps pipeline task
- task: DotNetCoreCLI@2
displayName: "Test ${{parameters.project}}.Tests"
inputs:
command: test
projects: src/${{parameters.project}}.Tests/${{parameters.project}}.Tests.csproj
arguments: '--configuration ${{parameters.configuration}} --collect "Code coverage"'
The How
After studying the migration guide as well as the code coverage docs for MTP, I ended up with the following changes.
global.json
Specify the test runner in global.json
"test": {
"runner": "Microsoft.Testing.Platform"
}
After doing that, the Azure DevOps YAML pipeline failed with the following error.
Zero tests ranExit code: 5Test run summary: Zero tests ran error: 1 total: 0 failed: 0 succeeded: 0 skipped: 0 duration: 246msTest run completed with non-success exit code: 5 (see: https://aka.ms/testingplatform/exitcodes)##[error]Error: The process '/opt/hostedtoolcache/dotnet/dotnet' failed with exit code 5
To get rid of this error which occurred several times during troubleshooting I needed to apply the following changes to make it work.
Azure DevOps pipeline task
Line 6: --coverage instead of --collect "Code coverage
- task: DotNetCoreCLI@2
displayName: "Test ${{parameters.project}}.Tests"
inputs:
command: test
projects: src/${{parameters.project}}.Tests/${{parameters.project}}.Tests.csproj
arguments: "--configuration ${{parameters.configuration}} --coverage"
.csproj file of the test project
- Line 5: specify output type
Exe - Line 12: replace
<PackageReference Include="coverlet.collector" Version="10.0.1">...</PackageReference>with<PackageReference Include="coverlet.MTP" Version="10.0.1" /> - Remove
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.9.0" /> - Remove
<PackageReference Include="xunit.runner.visualstudio" Version="4.0.0">...</PackageReference> - Add
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.10.0" /> - Add
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="2.3.3" />
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net10.0</TargetFramework> <OutputType>Exe</OutputType> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> <IsPackable>false</IsPackable> </PropertyGroup> <ItemGroup> <PackageReference Include="coverlet.MTP" Version="10.0.1" /> <PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.10.0" /> <PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="2.3.3" /> <PackageReference Include="xunit.v3" Version="4.0.0" /> </ItemGroup>
After all these changes, the test run successfully in VS2026 as well as in the Azure DevOps YAML pipeline on the Microsoft.Testing.Platform!


Leave a Reply