Skip to content
| Marketplace
Sign in
Visual Studio Code>Testing>Legacy .NET Test ExplorerNew to Visual Studio Code? Get it now.
Legacy .NET Test Explorer

Legacy .NET Test Explorer

Miroslav Bursa

| (0) | Free
Shows, runs and debugs xUnit, MSTest and NUnit tests of legacy .NET Framework projects (old-style .csproj, packages.config) in the VS Code Testing view.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Legacy .NET Test Explorer

Česká verze: README.cs.md

Run and debug the tests of old .NET Framework projects – classic (non-SDK) .csproj files, packages.config, .nuget\NuGet.config – right in the VS Code Testing view, just like the Test Explorer in Visual Studio.

The C# Dev Kit and dotnet test only understand SDK-style projects. This extension uses the tools of your Visual Studio installation instead (MSBuild and vstest.console.exe), so it works with projects that have never been migrated.

Supported frameworks: xUnit (v2), MSTest (v1 QualityTools and v2), NUnit (3, with NUnit3TestAdapter).

Features

  • Test tree Project → Namespace → Class → Method → theory rows (InlineData, TestCase, ...).
  • Tests appear immediately from the source code, even before the project is built. After a build the tree is refined from the real assembly (inherited tests, theory data rows, tests inside #if).
  • Run a whole project, a namespace, a class, a method or a single theory row. The project is built with MSBuild first (use the Run (without build) profile or a setting to skip it).
  • Debug tests with breakpoints, locals and stepping – using the clr debugger of the C# extension.
  • Results with duration, test output (ITestOutputHelper, Console, TestContext), failure messages with an expected/actual diff (xUnit, MSTest, NUnit) and a clickable stack trace.
  • The tree follows your edits, changes of the .csproj and builds (also builds done by Visual Studio).
  • Traits and categories ([Trait], [TestCategory], [Category]) are shown next to tests, Skip / [Ignore] as "skip".
  • Works with typical test stacks of such projects: AutoFixture (AutoData and custom data attributes), Moq, FluentAssertions, DeepEqual, DryIoc, xUnit collections and fixtures, BeforeAfterTestAttribute, Fody-woven assemblies.

Requirements

  • Windows with Visual Studio 2019/2022 or Build Tools (MSBuild and vstest.console.exe are found automatically through vswhere).
  • For debugging: the C# extension (ms-dotnettools.csharp). Its .NET Framework debugger supports 64-bit processes only, so tests built for x86 can be run but not debugged.
  • The test adapters your projects normally reference (xunit.runner.visualstudio, NUnit3TestAdapter, MSTest.TestAdapter). MSTest v1 is handled by Visual Studio itself.

Neither Node.js nor the .NET SDK is needed.

Settings (legacyTests.*)

Setting Default Description
configuration Debug Build configuration used to build and to locate the test assembly.
platform (empty) Project platform (AnyCPU, x64).
buildBeforeRun true Build the project before running or debugging.
restoreBeforeBuild firstBuild Restore NuGet packages (including packages.config): never / firstBuild / always.
portablePdb true Build with -p:DebugType=portable – the VS Code debugger cannot read classic Windows PDBs.
msbuildArguments [] Additional MSBuild arguments.
runSettings (empty) Path to a .runsettings file.
testPlatform (auto) Test host architecture (x86 / x64).
testAdapterPaths [] Additional folders with test adapters.
msbuildPath, vstestPath (auto) Explicit tool paths.
projectInclude / projectExclude **/*.csproj / packages, bin, obj, … Which project files to load.
discoverOnStartup, rediscoverOnAssemblyChange true Refine the tree from built assemblies at startup and after each build.
diagnosticLogging false Verbose vstest logs (the path is printed to the Legacy Tests output).

Commands: Legacy Tests: Reload Tests, Build Test Projects, Restore NuGet Packages, Show Output.

How it works

VS Code Testing API ── extension ──┬── MSBuild.exe         (restore, build)
                                   └── LegacyTestHost.exe ── vstest.console.exe ── test host + adapter

LegacyTestHost is a small .NET Framework 4.8 program built on Microsoft.TestPlatform.TranslationLayer, the same API Visual Studio uses: discovery with source locations, streaming results and a custom test host launch so the debugger can attach.

Projects built by Visual Studio usually have full (Windows) PDBs which the VS Code debugger cannot read. Before debugging such an assembly the extension rebuilds the project once with portable PDBs.

Known limitations

  • Windows only (the tools come from Visual Studio).
  • Debugging only for 64-bit test hosts.
  • Test categories of NUnit and MSTest are read from the source code only.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft