Quickstart Guide

July 17, 2026 · View on GitHub

This guide gets you running tests from the command line with the Visual Studio Test Platform (vstest.console.exe). For the exhaustive option list see command line options.

Which command should I use?

Most people don't run vstest.console.exe directly. Pick the entry point that fits your setup:

You have…UseNotes
The .NET SDKdotnet testRecommended. Builds the project and wraps vstest.console for you.
A built test assembly / CI runnervstest.console.exe <TestFile>The standalone runner. Does not build; you point it at already-built assemblies.
Old habit of dotnet vstestPrefer dotnet testdotnet vstest is deprecated in favor of dotnet test.

Getting the standalone runner

vstest.console is not a separate download; it ships inside NuGet packages (and with Visual Studio). Which package depends on the runtime you need:

  • .NET Framework runner (Windows) — the Microsoft.TestPlatform package. After restoring/extracting it the runner lives at tools/net462/Common7/IDE/Extensions/TestPlatform/vstest.console.exe and requires .NET Framework.
  • Cross-platform .NET runner — the Microsoft.TestPlatform.Portable package. It ships vstest.console.dll under tools/net8.0/, launched with dotnet path/to/vstest.console.dll, and requires a compatible .NET runtime.

When you use dotnet test, the runner and a matching runtime are already provided by the .NET SDK (pinned by your global.json), so there is nothing extra to install.

Your first run

  1. Build a test project (for example an MSTest, xUnit, or NUnit project) so you have a test assembly such as bin\Debug\net8.0\MyProject.Tests.dll.

  2. Run the tests:

    vstest.console.exe bin\Debug\net8.0\MyProject.Tests.dll
    

    Or, to build and run in one step with the SDK:

    dotnet test
    

You can pass more than one assembly and use wildcards:

vstest.console.exe **/bin/Debug/**/*.Tests.dll

The runner prints a per-test summary and a final total. Test results and any collected artifacts are written under a TestResults directory.

Common tasks

TaskCommand
Run a subset of testsvstest.console.exe Tests.dll /TestCaseFilter:"Priority=1"
Produce a TRX reportvstest.console.exe Tests.dll /logger:trx
Use a settings filevstest.console.exe Tests.dll /Settings:test.runsettings
Collect code coveragevstest.console.exe Tests.dll /Collect:"Code Coverage"
Run in parallelvstest.console.exe Tests.dll /Parallel
Capture diagnostic logsvstest.console.exe Tests.dll /Diag:log.txt

The equivalent dotnet test switches are --filter, --logger, --settings, --collect, and --diag.

Exit codes

vstest.console.exe returns 0 when the run succeeds and all executed tests pass, and 1 otherwise (test failure, run error, invalid command line, etc.). See Exit codes for details, including what happens when no tests match.

Learn more

New to running .NET tests? Start with the official .NET testing documentation:

Next steps

For test platform internals and extensibility, see the Overview and the RFCs.