Skip to main content
net8.0net9.0.NETStandard2.0

This package provides MSBuild integration of the platform, its extensions and configuration files. Microsoft Testing is a set of platform, framework and protocol intended to make it possible to run any test on any target or device.

Published
Oct 7, 2026
1mo ago
Total Downloads
312.8M
312,841,412

Install

dotnet add package Microsoft.Testing.Platform.MSBuild --version 2.5.1
ProductVersions
.NET
net8.0net9.0
.NET Standard
netstandard2.0

README

Microsoft.Testing.Platform.MSBuild

Microsoft.Testing.Platform.MSBuild provides the MSBuild tasks needed for Microsoft.Testing.Platform, including entry-point generation and test configuration file support.

Microsoft.Testing.Platform is open source. You can find Microsoft.Testing.Platform.MSBuild code in the microsoft/testfx GitHub repository.

Install the package

dotnet add package Microsoft.Testing.Platform.MSBuild

Usage

No manual API call is required. Referencing the package imports its MSBuild integration, which generates the test application entry point and copies testconfig.json to the output directory. Test framework packages normally reference this package transitively.

Command-line option argument defaults can be authored directly in testconfig.json:

{
  "commandLineOptionDefaults": {
    "report-trx-filename": "{asm}.trx"
  }
}

SDKs and shared build infrastructure can supply the same defaults through MSBuild:

<ItemGroup>
  <TestingPlatformCommandLineOptionDefault Include="report-trx-filename" Value="{asm}.trx" />
</ItemGroup>

These defaults are passive: they do not enable --report-trx or any other feature. An explicit command-line value or active commandLineOptions entry takes precedence. If both testconfig.json and MSBuild define the same default, the value in testconfig.json wins.

Generate an application-owned host entry point

Set TestingPlatformHostFactory to a fully qualified parameterless static method returning Task<IHost>:

<PropertyGroup>
  <TestingPlatformHostFactory>Contoso.Tests.TestHost.CreateHost</TestingPlatformHostFactory>
  <TestingPlatformOpenTelemetryMode>HostOwned</TestingPlatformOpenTelemetryMode>
</PropertyGroup>

The generated C#, Visual Basic, or F# entry point awaits one fresh, unstarted host, invokes IHost.RunTestingPlatformAsync, and disposes the host after MTP stops it, using asynchronous disposal when the host implements IAsyncDisposable. MTP arguments are never passed to the factory or Generic Host configuration. The ordinary generated source remains unchanged when TestingPlatformHostFactory is unset.

Hosted generation requires compatible Microsoft.Testing.Extensions.Hosting and generated self-registration. HostOwned additionally requires Microsoft.Testing.Extensions.OpenTelemetry; it auto-registers only AddTestingPlatformDiagnostics() and never creates a provider, exporter, resource identity, or dependency-injection container.

About

This package provides:

  • Entry-point generation: generates standalone or application-hosted C#, Visual Basic, and F# entry points for Microsoft.Testing.Platform test projects
  • Configuration file support: generates $(AssemblyName).testconfig.json from the project configuration and any TestingPlatformCommandLineOptionDefault items
  • dotnet test compatibility: enables running MTP-based test projects through the VSTest-based dotnet test command on .NET SDKs

This package is typically not referenced directly. Instead, test framework packages (such as MSTest) reference it automatically.

Documentation

For this package, see https://learn.microsoft.com/dotnet/core/testing/microsoft-testing-platform-intro#use-dotnet-test.

For comprehensive documentation, see https://aka.ms/testingplatform.

Feedback & contributing

Microsoft.Testing.Platform is an open source project. Provide feedback or report issues in the microsoft/testfx GitHub repository.

Changes from Previous Version

v2.5.0v2.5.1
Deprecation Removed
Deprecation notice was removed in this version.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

Compatibility metadata lists 3 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.