无法使用 vstest.console.exe 运行 specflow 测试

Unable to run specflow tests using vstest.console.exe

我正在尝试 运行 speflow 基于 visual studio 运行 的测试,但在 vsts 中出现错误。我正在使用以下 vsts 测试 运行ner 任务:

C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe myassembly.dll

错误:

System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types

Retrieve the LoaderExceptions property for more information.

我试过:

/TestAdapterPath: "Adapterpath"/UseVsixExtensions:True/False(Both option)/Platform:[ platform type ] 

...但其中 none 正在运行;测试在 Visual Studio 2017 年工作正常,但在 CI 工作中仍然没有工作。

下面几行代码帮助我识别了丢失的 dll,现在它正在构建,需要修复。

try
    {
    }
    catch (System.Reflection.ReflectionTypeLoadException ex)
    {
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        foreach (System.Exception exSub in ex.LoaderExceptions)
        {
            sb.AppendLine(exSub.Message);
            System.IO.FileNotFoundException exFileNotFound = exSub as System.IO.FileNotFoundException;
            if (exFileNotFound != null)
            {
                if (!string.IsNullOrEmpty(exFileNotFound.FusionLog))
                {
                    sb.AppendLine("Fusion Log:");
                    sb.AppendLine(exFileNotFound.FusionLog);
                }
            }
            sb.AppendLine();
        }
        string errorMessage = sb.ToString();
        throw new System.Exception(errorMessage);
    }