-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Labels
Description
For whatever reason I had a pretty old SDK sitting in the folder and the tool was picking 'vstest.console.dll' from it for Desktop. That lead to zero tests being discovered in the test assemblies, and sometimes to some very unhelpful error. Nothing was pointing to the problem explicitly. Almost accidentally I noticed strange version number in the path for 'vstest.console.dll' in 'runtests_.log'. I had to delete that SDK folder to get the tool working. I didn't check what the tool was using for Core tests, but they were executed.
It looks like the problem is in the function below. It picks a "random" 'vstest.console.dll'. We should consider locating one from the "current" SDK, whatever that means.
private static string GetVsTestConsolePath(string dotnetPath)
{
var dotnetDir = Path.GetDirectoryName(dotnetPath)!;
var sdkDir = Path.Combine(dotnetDir, "sdk");
var vsTestConsolePath = Directory.EnumerateFiles(sdkDir, "vstest.console.dll", SearchOption.AllDirectories).Last();
return vsTestConsolePath;
}