VS Test failing in Pipelines with missing 'Microsoft.NET.Test.Sdk'

I have solved my problem by revising my filter to find test assemblies. When i was messing around with my test step, accidentally set the filter to "/**/UnitTests.dll" and i did not realise that it was also matching UnitTests.dll in the "obj" folder and that folder does not have .deps.json files. From the logs i noticed that it was running tests twice (once for each matching dll) so then i ignored the obj folder by reverting back my filter to exclude obj folder. So i guess two things to take care in such cases,

  1. You must have "Microsoft.NET.Test.Sdk" installed on your test project and
  2. Your filter does not include or exclude any unwanted dll(s) which you (don't want / want to) be there

If anyone gets this after upgrading to .Net 5.0 it now creates a reference assembly in the ref folder, with the same name as the output assembly. You need to ignore this in your search criteria: !**/ref/**