我正在尝试基于visual studio runner运行speflow
测试,但在vsts
中收到错误。我正在使用以下vsts
测试运行器任务:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe myassembly.dll
错误:
System.Reflection.ReflectionTypeLoadException:无法加载一个或多个请求的类型
检索LoaderExceptions属性以获取更多信息。
我试过了:
/TestAdapterPath: "Adapterpath"/UseVsixExtensions:True/False(Both option)/Platform:[ platform type ]
......但这些都不起作用;测试在Visual Studio 2017中运行良好,但仍然无法在CI作业中使用。
答案 0 :(得分:0)
下面的代码行帮助我找出了现在需要修复的缺失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);
}