From e1353c79ec8c7ad1f1ef9429a86a935a9d4fa94a Mon Sep 17 00:00:00 2001 From: mariam-abdulla Date: Mon, 8 Sep 2025 09:03:05 +0200 Subject: [PATCH 1/7] replace dotnet.config with global.json --- docs/core/tools/dotnet-test.md | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/docs/core/tools/dotnet-test.md b/docs/core/tools/dotnet-test.md index 062608d4ccc2f..dfd8675edc43e 100644 --- a/docs/core/tools/dotnet-test.md +++ b/docs/core/tools/dotnet-test.md @@ -11,18 +11,24 @@ ms.date: 03/27/2024 ## Description -The `dotnet test` command builds the solution and runs the tests with either VSTest or Microsoft Testing Platform (MTP). To enable MTP, you need to add a config file named `dotnet.config` with an INI-like format located at the root of the solution or repository. +The `dotnet test` command builds the solution and runs the tests with either VSTest or Microsoft Testing Platform (MTP). To enable MTP, you need to specify the test runner in the `global.json` file. -Some examples of the `dotnet.config` file: +Some examples of how to specify the test runner in the `global.json` file: - ```ini - [dotnet.test.runner] - name = "Microsoft.Testing.Platform" + ```json + { + "test": { + "runner": "Microsoft.Testing.Platform" + } + } ``` - ```ini - [dotnet.test.runner] - name = "VSTest" + ```json + { + "test": { + "runner": "VSTest" + } + } ``` > [!IMPORTANT] @@ -448,7 +454,7 @@ dotnet test -h|--help With Microsoft Testing Platform, `dotnet test` operates faster than with VSTest. The test-related arguments are no longer fixed, as they are tied to the registered extensions in the test project(s). Moreover, MTP supports a globbing filter when running tests. For more information, see [Microsoft.Testing.Platform](../testing/microsoft-testing-platform-intro.md). > [!WARNING] -> When Microsoft.Testing.Platform is opted in via `dotnet.config`, `dotnet test` expects all test projects to use Microsoft.Testing.Platform. It is an error if any of the test projects use VSTest. +> When Microsoft.Testing.Platform is opted in via `global.json`, `dotnet test` expects all test projects to use Microsoft.Testing.Platform. It is an error if any of the test projects use VSTest. #### Implicit restore From 41fcf5181e61ab6dc3247c38548c490d2f958b93 Mon Sep 17 00:00:00 2001 From: mariam-abdulla Date: Tue, 9 Sep 2025 09:46:02 +0200 Subject: [PATCH 2/7] Remove occurences of dotnet.config --- .../core/testing/unit-testing-with-dotnet-test.md | 15 +++++++++------ docs/core/whats-new/dotnet-10/sdk.md | 11 +++++++---- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/docs/core/testing/unit-testing-with-dotnet-test.md b/docs/core/testing/unit-testing-with-dotnet-test.md index 473c6a13363c0..1b18cd910f249 100644 --- a/docs/core/testing/unit-testing-with-dotnet-test.md +++ b/docs/core/testing/unit-testing-with-dotnet-test.md @@ -91,11 +91,14 @@ Due to these issues, .NET has introduced a new `dotnet test` mode specifically d To address the issues encountered when running `dotnet test` with MTP in VSTest mode, .NET introduced a new mode in the .NET 10 SDK that's specifically designed for MTP. -To enable this mode, add a `dotnet.config` file to the root of the repository or solution. - -```ini -[dotnet.test.runner] -name = "Microsoft.Testing.Platform" +To enable this mode, add the following configuration to your `global.json` file: + +```json +{ + "test": { + "runner": "Microsoft.Testing.Platform" + } +} ``` > [!IMPORTANT] @@ -123,7 +126,7 @@ Since this mode is specifically designed for Microsoft.Testing.Platform, neither For users of MTP that are using the VSTest mode of `dotnet test`, there are few actions needed to migrate to the newer `dotnet test` experience: -1. Add `dotnet.config` in the root of your repository, as shown above. +1. Add some configuration to your `global.json` file, as shown above. 1. Remove `TestingPlatformDotnetTestSupport` MSBuild property, as it's no longer required. 1. Remove `TestingPlatformCaptureOutput` and `TestingPlatformShowTestsFailure` MSBuild properties, as they are no longer used by the new `dotnet test`. 1. Remove the extra `--`, for example `dotnet test -- --report-trx` should become `dotnet test --report-trx`. diff --git a/docs/core/whats-new/dotnet-10/sdk.md b/docs/core/whats-new/dotnet-10/sdk.md index d1ad48ef454c2..9d7fe0f89e9a5 100644 --- a/docs/core/whats-new/dotnet-10/sdk.md +++ b/docs/core/whats-new/dotnet-10/sdk.md @@ -215,11 +215,14 @@ A new `` property allows you to explicitly set the format ## Support for Microsoft Testing Platform in `dotnet test` -Starting in .NET 10, `dotnet test` natively supports [Microsoft.Testing.Platform](../../testing/microsoft-testing-platform-intro.md). To enable this feature, add the following configuration to your *dotnet.config* file: +Starting in .NET 10, `dotnet test` natively supports [Microsoft.Testing.Platform](../../testing/microsoft-testing-platform-intro.md). To enable this feature, add the following configuration to your *global.json* file: -```ini -[dotnet.test.runner] -name = "Microsoft.Testing.Platform" +```json +{ + "test": { + "runner": "Microsoft.Testing.Platform" + } +} ``` For more details, see [Testing with `dotnet test`](../../testing/unit-testing-with-dotnet-test.md). From 7e9cef636f36d97bb45fec711006f58be32929c7 Mon Sep 17 00:00:00 2001 From: mariam-abdulla Date: Tue, 9 Sep 2025 10:17:28 +0200 Subject: [PATCH 3/7] Add link of global.json --- docs/core/tools/dotnet-test.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/tools/dotnet-test.md b/docs/core/tools/dotnet-test.md index dfd8675edc43e..95c1d49e42b0a 100644 --- a/docs/core/tools/dotnet-test.md +++ b/docs/core/tools/dotnet-test.md @@ -13,7 +13,7 @@ ms.date: 03/27/2024 The `dotnet test` command builds the solution and runs the tests with either VSTest or Microsoft Testing Platform (MTP). To enable MTP, you need to specify the test runner in the `global.json` file. -Some examples of how to specify the test runner in the `global.json` file: +Some examples of how to specify the test runner in the [`global.json`](global-json.md) file: ```json { From f1463a3b3f04de9b465c10c0662c9364bba41b73 Mon Sep 17 00:00:00 2001 From: Mariam Abdullah <122357303+mariam-abdulla@users.noreply.github.com> Date: Thu, 11 Sep 2025 08:41:39 +0200 Subject: [PATCH 4/7] Update docs/core/testing/unit-testing-with-dotnet-test.md Co-authored-by: Youssef Victor --- docs/core/testing/unit-testing-with-dotnet-test.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/testing/unit-testing-with-dotnet-test.md b/docs/core/testing/unit-testing-with-dotnet-test.md index 1b18cd910f249..28deb367d890a 100644 --- a/docs/core/testing/unit-testing-with-dotnet-test.md +++ b/docs/core/testing/unit-testing-with-dotnet-test.md @@ -126,7 +126,7 @@ Since this mode is specifically designed for Microsoft.Testing.Platform, neither For users of MTP that are using the VSTest mode of `dotnet test`, there are few actions needed to migrate to the newer `dotnet test` experience: -1. Add some configuration to your `global.json` file, as shown above. +1. Add `test` section to your `global.json` file, as shown above. 1. Remove `TestingPlatformDotnetTestSupport` MSBuild property, as it's no longer required. 1. Remove `TestingPlatformCaptureOutput` and `TestingPlatformShowTestsFailure` MSBuild properties, as they are no longer used by the new `dotnet test`. 1. Remove the extra `--`, for example `dotnet test -- --report-trx` should become `dotnet test --report-trx`. From 47d0415952daf7a25f669cda042fd6c992f79596 Mon Sep 17 00:00:00 2001 From: mariam-abdulla Date: Thu, 11 Sep 2025 14:21:30 +0200 Subject: [PATCH 5/7] Update global.json doc --- docs/core/tools/global-json.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/core/tools/global-json.md b/docs/core/tools/global-json.md index 829ba9743ddf3..03e4be413d040 100644 --- a/docs/core/tools/global-json.md +++ b/docs/core/tools/global-json.md @@ -112,6 +112,19 @@ Type: `object` Lets you control the project SDK version in one place rather than in each individual project. For more information, see [How project SDKs are resolved](/visualstudio/msbuild/how-to-use-project-sdk#how-project-sdks-are-resolved). +### test + +- Type: `object` + +Specifies information about tests. + +### runner + +- Type: `string` +- Available since: .NET 10.0 SDK. + +The test runner to discover/run tests with. + ### Comments in global.json Comments in *global.json* files are supported using JavaScript or C# style comments. For example: @@ -195,6 +208,16 @@ The following example shows how to specify additional SDK search paths and a cus } ``` +The following example shows how to specify `Microsoft.Testing.Platform` as the test runner: + +```json +{ + "test": { + "runner": "Microsoft.Testing.Platform" + } +} +``` + ## global.json and the .NET CLI To set an SDK version in the *global.json* file, it's helpful to know which SDK versions are installed on your machine. For information on how to do that, see [How to check that .NET is already installed](../install/how-to-detect-installed-versions.md#check-sdk-versions). From 13046a985491cbe9ff48e2647dccd34a3c010c32 Mon Sep 17 00:00:00 2001 From: Mariam Abdullah <122357303+mariam-abdulla@users.noreply.github.com> Date: Mon, 15 Sep 2025 08:55:04 +0200 Subject: [PATCH 6/7] Update docs/core/tools/global-json.md Co-authored-by: Youssef Victor --- docs/core/tools/global-json.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/tools/global-json.md b/docs/core/tools/global-json.md index 03e4be413d040..1352c26771d42 100644 --- a/docs/core/tools/global-json.md +++ b/docs/core/tools/global-json.md @@ -112,7 +112,7 @@ Type: `object` Lets you control the project SDK version in one place rather than in each individual project. For more information, see [How project SDKs are resolved](/visualstudio/msbuild/how-to-use-project-sdk#how-project-sdks-are-resolved). -### test +### `test` - Type: `object` From 7ab586610130138da59331404fe0ee5cae4f5c8d Mon Sep 17 00:00:00 2001 From: Mariam Abdullah <122357303+mariam-abdulla@users.noreply.github.com> Date: Mon, 15 Sep 2025 08:55:45 +0200 Subject: [PATCH 7/7] Update docs/core/tools/global-json.md Co-authored-by: Youssef Victor --- docs/core/tools/global-json.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/tools/global-json.md b/docs/core/tools/global-json.md index 1352c26771d42..13492011a2332 100644 --- a/docs/core/tools/global-json.md +++ b/docs/core/tools/global-json.md @@ -118,7 +118,7 @@ Lets you control the project SDK version in one place rather than in each indivi Specifies information about tests. -### runner +### `runner` - Type: `string` - Available since: .NET 10.0 SDK.