🛠️ The Test Project That Built, and Then Found Nothing
A test project depends on a specific test adapter package to let Visual Studio’s Test Explorer discover and run the tests it contains, and that adapter is resolved and loaded independently of whether the project itself compiles successfully – which means a restore that pulls in a slightly different, incompatible version of the test adapter, the test framework, or the shared SDK they both depend on can leave a project that builds completely cleanly with zero tests showing up anywhere in Test Explorer, no error reported, and no obvious link back to the restore that just ran moments earlier.
🔎 The Problem
1. Test project builds successfully - Build Succeeded, zero errors, zero warnings related to the test framework itself. 2. Test Explorer shows the test project listed, but with zero individual tests underneath it - no error icon, no red text, just an empty node where dozens of tests used to appear. 3. Recent action: ran a NuGet restore after pulling teammates' changes, which updated the test SDK package (Microsoft.NET.Test.Sdk) to a newer version, while the test adapter package (e.g. xunit.runner.visualstudio) stayed pinned at its previous version in this project's own file. 4. Output window, Tests category, shows a quiet warning about an adapter failing to load or a version mismatch - easy to miss entirely unless that specific output category is selected. The build succeeds because the test SDK/adapter mismatch doesn't actually break compilation - it only affects whether Test Explorer's discovery process can successfully load and talk to the adapter at runtime, which is a completely separate step from compiling the project's code.
✅ Fix: Keep the Test SDK and Adapter Versions Moving Together
- Check the Output window’s Tests category specifically after any restore that touches a test project, since the actual warning about a failed or mismatched adapter load is usually sitting there in plain text, just in a pane most people never select unless they already suspect test discovery is broken.
- Update the test framework’s adapter package to a version compatible with the test SDK version the restore just pulled in, rather than leaving one pinned while the other moves – the two are meant to be upgraded together, not independently.
- Add a central package version management file, or explicitly pin both the test SDK and the adapter package together in the same place, so a future restore can’t silently update one without the other drifting out of a compatible version range.
⚠️ Why This Is Easy to Miss
- A successful build gives every visual signal that the project is in a healthy state, so there’s no natural reason to suspect the restore that just ran is actually the cause of a completely separate-seeming problem in Test Explorer a few minutes later.
- Test Explorer showing an empty, test-free project looks identical whether the cause is an adapter version mismatch, a build configuration issue, or genuinely zero tests existing in that project – there’s no prominent error state to distinguish “broken discovery” from “nothing to discover.”
Compiling a test project and actually discovering its tests are two separate jobs – a restore can quietly break the second one while leaving the first looking perfectly fine.





