This was a headscratcher which neither AI or Google knew about or could fix for me.
At work we have a large monolith with a combination of net48, netstandard and net8 projects. I’m upgrading the net8 ones to net10, as net8 is nearing its EOL.
When I upgraded the first of our test projects to net10, I started getting the above error in our CI pipeline.
First pro tip: if you can, reproduce the issue at the command line with vstest.console.exe, rather than trying to fix it by pushing changes and waiting for your CI build server to fail. This will speed up your feedback loop by about 100x.
Eventually I figured out that the issue:
One of our net8 test helper projects is called MyCompany.Core.Common.Tests, so it was accidentally being included via testAssemblyVer2: | **\MyCompany.*tests.dll. This helper project referenced Microsoft.NET.Test.Sdk but actually contained no tests.
Once I excluded that dll the issue went away. Again, it was all working fine when everything was net8 but only broke when one of our test assemblies was upgraded to net10.
testAssemblyVer2: |
**\MyCompany.*tests.dll
!**\MyCompany.Core.Common.Tests.dll