From bc9407e9122dd8cef6842eda8aa0d77841b07d80 Mon Sep 17 00:00:00 2001 From: Azat Mukhametshin Date: Mon, 13 Jul 2026 16:29:54 +0200 Subject: [PATCH 1/5] Fix vstest docs links and runsettings CLI guidance Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4e840b63-ad95-40c2-9ef8-5f2fcc4cfdaa --- ...t-tests-by-using-a-dot-runsettings-file.md | 30 ++++++++++++++++++- docs/test/vstest-console-options.md | 8 ++--- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/docs/test/configure-unit-tests-by-using-a-dot-runsettings-file.md b/docs/test/configure-unit-tests-by-using-a-dot-runsettings-file.md index e7e74b989c8..b0ce7048874 100644 --- a/docs/test/configure-unit-tests-by-using-a-dot-runsettings-file.md +++ b/docs/test/configure-unit-tests-by-using-a-dot-runsettings-file.md @@ -1,7 +1,7 @@ --- title: Configure unit tests with a .runsettings file description: Learn how to use the .runsettings file in Visual Studio to configure unit tests that are run from the command line, from the IDE, or in a build workflow. -ms.date: 12/17/2025 +ms.date: 07/13/2026 ms.topic: how-to ms.author: mikejo @@ -150,6 +150,34 @@ To run tests from the command line, use *vstest.console.exe*, and specify the se For more information, see [VSTest.Console.exe command-line options](vstest-console-options.md). +## Override run settings from the command line + +You can also override some run settings directly from the command line. Specify run settings as name-value pairs after `--`. Include the space after `--`; all arguments after `--` are treated as run settings overrides, so these arguments must be last. Command-line run settings overrides take precedence over values from a file passed with `--settings`. + +```cmd +dotnet test -- MSTest.MapInconclusiveToFailed=True MSTest.DeploymentEnabled=False +``` + +Starting with the .NET SDK 5.0, you can set **TestRunParameters** from the command line: + +```cmd +dotnet test -- TestRunParameters.Parameter(name="myParam", value="value") +``` + +Shell quoting rules differ. In Command Prompt, escape quotation marks as needed. In PowerShell 7.3 and later, native command argument handling supports this syntax more directly; in earlier PowerShell versions, or when `$PSNativeCommandArgumentPassing` is set to `legacy`, use the `--%` stop-parsing token. In Bash, escape characters such as parentheses, quotation marks, spaces, and semicolons. + +Parameter values can contain semicolons and other special characters, such as connection strings, but the shell must pass them through literally. For complex values, consider using a *.runsettings* file instead: + +```xml + + + + + +``` + +For more command-line examples and shell-specific quoting details, see [Passing runsettings arguments through commandline](https://github.com/microsoft/vstest/blob/main/docs/RunSettingsArguments.md). + ## The *.runsettings file The *.runsettings file is an XML file that contains different configuration elements within the **RunSettings** element. The sections that follow detail the different elements. For a complete sample, see [Example *.runsettings file](#example-runsettings-file). diff --git a/docs/test/vstest-console-options.md b/docs/test/vstest-console-options.md index f4223c3ec17..ceaabe36ed3 100644 --- a/docs/test/vstest-console-options.md +++ b/docs/test/vstest-console-options.md @@ -1,7 +1,7 @@ --- title: VSTest.Console.exe command-line options description: Learn about the VSTest.Console.exe command-line tool that runs tests. This article includes the General command-line options. -ms.date: 02/28/2025 +ms.date: 07/13/2026 ms.topic: reference helpviewer_keywords: - vstest.console.exe @@ -38,7 +38,7 @@ The following table lists all the options for *VSTest.Console.exe* and short des |**/TestAdapterPath:[*path*]**|Forces the *vstest.console.exe* process to use custom test adapters from a specified path (if any) in the test run.
Example: `/TestAdapterPath:[pathToCustomAdapters]`| |**/Platform:[*platform type*]**|Forces the given platform to be used, instead of the platform determined from the current runtime. This option is able to force only x86, and x64 platforms on Windows. The ARM option is broken and will result in x64 on most systems.
Do NOT specify this option to run on runtimes that aren't in the list of valid values such as ARM64.
Valid values are x86, x64, and ARM.
|**/Framework: [*framework version*]**|Target .NET version to be used for test execution.
Example values are `Framework35`, `Framework40`, `Framework45`, `FrameworkUap10`, `.NETCoreApp,Version=v1.1`.
TargetFrameworkAttribute is used to automatically detect this option from your assembly, and defaults to `Framework40` when the attribute isn't present. You must specify this option explicitly if you remove the [TargetFrameworkAttribute](/dotnet/api/system.runtime.versioning.targetframeworkattribute) from your .NET Core assemblies.
If the target framework is specified as **Framework35**, the tests run in CLR 4.0 "compatibility mode".
Example: `/Framework:framework40`| -|**/TestCaseFilter:[*expression*]**|Run tests that match the given expression.
is of the format =[\|].
Example: `/TestCaseFilter:"Priority=1"`
Example: `/TestCaseFilter:"TestCategory=Nightly|FullyQualifiedName=Namespace.ClassName.MethodName"`
The **/TestCaseFilter** command-line option can't be used with the **/Tests** command-line option.
For information about creating and using expressions, see [TestCase filter](https://github.com/Microsoft/vstest-docs/blob/main/docs/filter.md).| +|**/TestCaseFilter:[*expression*]**|Run tests that match the given expression.
is of the format =[\|].
Example: `/TestCaseFilter:"Priority=1"`
Example: `/TestCaseFilter:"TestCategory=Nightly|FullyQualifiedName=Namespace.ClassName.MethodName"`
The **/TestCaseFilter** command-line option can't be used with the **/Tests** command-line option.
For information about creating and using expressions, see [TestCase filter](https://github.com/microsoft/vstest/blob/main/docs/filter.md).| |**/?**|Displays usage information.| |**/Logger:[*uri/friendlyname*]**|Specify a logger for test results. Specify the parameter multiple times to enable multiple loggers.
Example: To log results into a Visual Studio Test Results File (TRX), use
**/Logger:trx**
**[;LogFileName=\]**
For more information, see [Logging example](#logging-example).| |**/ListTests:[*file name*]**|Lists discovered tests from the given test container.
Note: The `/TestCaseFilters` option has no effect when listing tests; it only controls which tests get run.| @@ -46,12 +46,12 @@ The following table lists all the options for *VSTest.Console.exe* and short des |**/ListExecutors**|Lists installed test executors.| |**/ListLoggers**|Lists installed test loggers.| |**/ListSettingsProviders**|Lists installed test settings providers.| -|**/Blame**|Runs the tests in blame mode. This option is helpful in isolating problematic tests that cause the test host to crash. When a crash is detected, it creates a sequence file in `TestResults//_Sequence.xml` that captures the order of tests that were run before the crash. For more information, see [Blame data collector](https://github.com/Microsoft/vstest-docs/blob/main/docs/extensions/blame-datacollector.md).| +|**/Blame**|Runs the tests in blame mode. This option is helpful in isolating problematic tests that cause the test host to crash. When a crash is detected, it creates a sequence file in `TestResults//_Sequence.xml` that captures the order of tests that were run before the crash. For more information, see [Blame data collector](https://github.com/microsoft/vstest/blob/main/docs/extensions/blame-datacollector.md).| |**/Diag:[*file name*]**|Writes diagnostic trace logs to the specified file.| |**/ResultsDirectory:[*path*]**|Test results directory will be created in specified path if not exists.
Example: `/ResultsDirectory:`| |**/ParentProcessId:[*parentProcessId*]**|Process ID of the Parent Process responsible for launching current process.| |**/Port:[*port*]**|The Port for socket connection and receiving the event messages.| -|**/Collect:[*dataCollector friendlyName*]**|Enables data collector for the test run. [More information](https://github.com/Microsoft/vstest-docs/blob/main/docs/analyze.md).| +|**/Collect:[*dataCollector friendlyName*]**|Enables data collector for the test run. [More information](https://github.com/microsoft/vstest/blob/main/docs/analyze.md).| > [!TIP] > The options and values aren't case-sensitive. From 493e7a23bcb73acbfb806c8ba372c432d28e6d69 Mon Sep 17 00:00:00 2001 From: Azat Mukhametshin Date: Mon, 13 Jul 2026 17:21:08 +0200 Subject: [PATCH 2/5] Add link to vstest logger catalog and authoring guide (Topic 5) Cross-reference microsoft/vstest report.md for the full list of built-in and community test loggers and instructions for authoring a logger. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4e840b63-ad95-40c2-9ef8-5f2fcc4cfdaa --- docs/test/vstest-console-options.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/test/vstest-console-options.md b/docs/test/vstest-console-options.md index ceaabe36ed3..b1831d8c4f8 100644 --- a/docs/test/vstest-console-options.md +++ b/docs/test/vstest-console-options.md @@ -119,6 +119,8 @@ In PowerShell, you need to use quotes: vstest.console.exe myTestFile.dll /logger:"console;verbosity=detailed" ``` +For the full list of available loggers — including the built-in console, TRX, and HTML loggers and community loggers for xUnit, NUnit, JUnit, AppVeyor, Azure Pipelines, GitHub Actions, and TeamCity — as well as instructions for authoring your own logger, see [Reporting test results](https://github.com/microsoft/vstest/blob/main/docs/report.md) in the vstest repository. + ## UWP example For UWP, the appxrecipe file must be referenced instead of a DLL. From b7ccf2622a07a7dd35176fe2952332fd79b1e783 Mon Sep 17 00:00:00 2001 From: Azat Mukhametshin Date: Tue, 14 Jul 2026 12:37:06 +0200 Subject: [PATCH 3/5] Use vstest.console.exe examples on the vstest.console runsettings page The command-line override section is introduced with vstest.console.exe but used dotnet test examples. vstest.console.exe supports the same -- name=value inline runsettings override natively (CliRunSettingsArgumentProcessor), so show the vstest.console.exe form to match the page's context, and note dotnet test uses the same syntax. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4e840b63-ad95-40c2-9ef8-5f2fcc4cfdaa --- ...igure-unit-tests-by-using-a-dot-runsettings-file.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/test/configure-unit-tests-by-using-a-dot-runsettings-file.md b/docs/test/configure-unit-tests-by-using-a-dot-runsettings-file.md index b0ce7048874..d5287329af3 100644 --- a/docs/test/configure-unit-tests-by-using-a-dot-runsettings-file.md +++ b/docs/test/configure-unit-tests-by-using-a-dot-runsettings-file.md @@ -152,16 +152,18 @@ For more information, see [VSTest.Console.exe command-line options](vstest-conso ## Override run settings from the command line -You can also override some run settings directly from the command line. Specify run settings as name-value pairs after `--`. Include the space after `--`; all arguments after `--` are treated as run settings overrides, so these arguments must be last. Command-line run settings overrides take precedence over values from a file passed with `--settings`. +You can also override some run settings directly from the command line. Specify run settings as name-value pairs after `--`. Include the space after `--`; all arguments after `--` are treated as run settings overrides, so these arguments must be last. Command-line run settings overrides take precedence over values from a file passed with `/Settings`. ```cmd -dotnet test -- MSTest.MapInconclusiveToFailed=True MSTest.DeploymentEnabled=False +vstest.console.exe test.dll -- MSTest.MapInconclusiveToFailed=True MSTest.DeploymentEnabled=False ``` -Starting with the .NET SDK 5.0, you can set **TestRunParameters** from the command line: +The same syntax works with `dotnet test` (use `dotnet test -- MSTest.MapInconclusiveToFailed=True`). + +You can set **TestRunParameters** from the command line: ```cmd -dotnet test -- TestRunParameters.Parameter(name="myParam", value="value") +vstest.console.exe test.dll -- TestRunParameters.Parameter(name="myParam", value="value") ``` Shell quoting rules differ. In Command Prompt, escape quotation marks as needed. In PowerShell 7.3 and later, native command argument handling supports this syntax more directly; in earlier PowerShell versions, or when `$PSNativeCommandArgumentPassing` is set to `legacy`, use the `--%` stop-parsing token. In Bash, escape characters such as parentheses, quotation marks, spaces, and semicolons. From bc282e7cb9e0bb2683e08597be4fda74471e55f5 Mon Sep 17 00:00:00 2001 From: Azat Mukhametshin Date: Tue, 14 Jul 2026 17:00:39 +0200 Subject: [PATCH 4/5] Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../configure-unit-tests-by-using-a-dot-runsettings-file.md | 4 ++-- docs/test/vstest-console-options.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/test/configure-unit-tests-by-using-a-dot-runsettings-file.md b/docs/test/configure-unit-tests-by-using-a-dot-runsettings-file.md index d5287329af3..162ab578cb2 100644 --- a/docs/test/configure-unit-tests-by-using-a-dot-runsettings-file.md +++ b/docs/test/configure-unit-tests-by-using-a-dot-runsettings-file.md @@ -152,7 +152,7 @@ For more information, see [VSTest.Console.exe command-line options](vstest-conso ## Override run settings from the command line -You can also override some run settings directly from the command line. Specify run settings as name-value pairs after `--`. Include the space after `--`; all arguments after `--` are treated as run settings overrides, so these arguments must be last. Command-line run settings overrides take precedence over values from a file passed with `/Settings`. +You can also override some run settings directly from the command line. Specify run settings overrides after `--`. Include the space after `--`; all arguments after `--` are treated as run settings overrides, so these arguments must be last. Command-line run settings overrides take precedence over values from a file passed with `/Settings`. ```cmd vstest.console.exe test.dll -- MSTest.MapInconclusiveToFailed=True MSTest.DeploymentEnabled=False @@ -178,7 +178,7 @@ Parameter values can contain semicolons and other special characters, such as co ``` -For more command-line examples and shell-specific quoting details, see [Passing runsettings arguments through commandline](https://github.com/microsoft/vstest/blob/main/docs/RunSettingsArguments.md). +For more command-line examples and shell-specific quoting details, see [Passing runsettings arguments through the command line](https://github.com/microsoft/vstest/blob/main/docs/RunSettingsArguments.md). ## The *.runsettings file diff --git a/docs/test/vstest-console-options.md b/docs/test/vstest-console-options.md index b1831d8c4f8..d0503767c36 100644 --- a/docs/test/vstest-console-options.md +++ b/docs/test/vstest-console-options.md @@ -119,7 +119,7 @@ In PowerShell, you need to use quotes: vstest.console.exe myTestFile.dll /logger:"console;verbosity=detailed" ``` -For the full list of available loggers — including the built-in console, TRX, and HTML loggers and community loggers for xUnit, NUnit, JUnit, AppVeyor, Azure Pipelines, GitHub Actions, and TeamCity — as well as instructions for authoring your own logger, see [Reporting test results](https://github.com/microsoft/vstest/blob/main/docs/report.md) in the vstest repository. +For the full list of available loggers, as well as instructions for authoring your own logger, see [Reporting test results](https://github.com/microsoft/vstest/blob/main/docs/report.md) in the vstest repository. ## UWP example From 04ba0c2bc778fffa7e6c64158b4c182dde7d65ee Mon Sep 17 00:00:00 2001 From: Azat Mukhametshin Date: Wed, 15 Jul 2026 22:38:16 +0200 Subject: [PATCH 5/5] Add zsh shell quoting rules for runsettings command-line overrides Address PR review feedback: document unix shell (zsh) escaping rules for the `TestRunParameters.Parameter(...)` override syntax, using zsh as the macOS default-shell example. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0cc38362-9c3b-46eb-8142-9c49c63dc4a0 --- ...onfigure-unit-tests-by-using-a-dot-runsettings-file.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/test/configure-unit-tests-by-using-a-dot-runsettings-file.md b/docs/test/configure-unit-tests-by-using-a-dot-runsettings-file.md index 162ab578cb2..1f25235561b 100644 --- a/docs/test/configure-unit-tests-by-using-a-dot-runsettings-file.md +++ b/docs/test/configure-unit-tests-by-using-a-dot-runsettings-file.md @@ -1,7 +1,7 @@ --- title: Configure unit tests with a .runsettings file description: Learn how to use the .runsettings file in Visual Studio to configure unit tests that are run from the command line, from the IDE, or in a build workflow. -ms.date: 07/13/2026 +ms.date: 07/15/2026 ms.topic: how-to ms.author: mikejo @@ -168,6 +168,12 @@ vstest.console.exe test.dll -- TestRunParameters.Parameter(name="myParam", value Shell quoting rules differ. In Command Prompt, escape quotation marks as needed. In PowerShell 7.3 and later, native command argument handling supports this syntax more directly; in earlier PowerShell versions, or when `$PSNativeCommandArgumentPassing` is set to `legacy`, use the `--%` stop-parsing token. In Bash, escape characters such as parentheses, quotation marks, spaces, and semicolons. +In zsh (the default shell on macOS), use the same escaping as Bash: escape quotation marks, spaces, and semicolons. Because zsh also treats unquoted parentheses as globbing and array syntax, always escape or quote the parentheses in `TestRunParameters.Parameter(...)`. For example: + +```zsh +vstest.console.exe test.dll -- TestRunParameters.Parameter\(name=\"myParam\",\ value=\"value\"\) +``` + Parameter values can contain semicolons and other special characters, such as connection strings, but the shell must pass them through literally. For complex values, consider using a *.runsettings* file instead: ```xml