I had a similar issue: Visual Studio would recognize and run unit test projects, but Rider wouldn't recognize them (Unit Test Explorer) nor let me manually run them (Right-Click->Run Unit Test).
The unit tests are targeting older framework versions (4.6.1 and some .net standard 2.0) for a legacy product.
The fix for me was to ensure the MSTest.TestAdapter package was installed. The MSTest.TestFramework was installed and its version matched all other working projects. But the newly-created projects did not have this package (MSTest.Adapter) included automatically / when creating the project using the latest version of Visual Studio at the time (August 2023).
TL;DR: ensure that both MSTest.TestFramework AND MSTest.TestAdapter are added as nuget packages. You may also have to manually update the csproj to ensure the correct and tags exist. Of note for my situation: the test adapter locations were relative paths that look for the packages directory of the solution.
e.g.
<Import Project="..\..\..\..\packages\MSTest.TestAdapter.2.2.3\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\..\..\..\packages\MSTest.TestAdapter.2.2.3\build\net45\MSTest.TestAdapter.props')" />
<Import Project="..\..\..\..\packages\MSTest.TestAdapter.2.2.3\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\..\..\..\packages\MSTest.TestAdapter.2.2.3\build\net45\MSTest.TestAdapter.targets')" />
And then in the "EnsureNuGetPackageBuildImports" target that some projects have, the similar path structure should be present in the error entries:
<Error Condition="!Exists('..\..\..\..\packages\MSTest.TestAdapter.2.2.3\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\MSTest.TestAdapter.2.2.3\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\..\..\..\packages\MSTest.TestAdapter.2.2.3\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\MSTest.TestAdapter.2.2.3\build\net45\MSTest.TestAdapter.targets'))" />
Report a Bug
, agree to attach logs. – KandrakandyBuild selected projects
on unit test project,Run unit tests
button wasn't disabled anymore – Laureate