Legacy .NET Test ExplorerČeská verze: README.cs.md Run and debug the tests of old .NET Framework projects – classic (non-SDK) The C# Dev Kit and Supported frameworks: xUnit (v2), MSTest (v1 Features
Requirements
Neither Node.js nor the .NET SDK is needed. Settings (
|
| 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.