You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

nunit3-netcore-console.dll无法识别部分测试程序集的测试用例

NUnit3控制台工具--explore参数无法识别部分测试程序集的问题
  • 使用nunit3-netcore-console 3.16.3配合--explore参数枚举96个C#测试程序集的测试用例,其中7个程序集无法被识别出测试用例
  • 执行命令:dotnet nunit3-netcore-console.dll --noheader --explore Tests.dll
  • 该问题在Windows和Linux环境下均存在

已排查内容

  • 对比可用与不可用程序集的csproj文件,未发现明显差异:
    • 均以.NET 6为目标框架
    • 依赖版本完全一致:Microsoft.NET.Test.Sdk(17.7.0)、NUnit(3.13.3)、NUnit3TestAdapter(4.5.0)
    • App.config中无程序集重定向配置
  • 换用nunit3-console.exe 3.10.0测试,存在相同问题
  • dotnet test可正常运行所有测试,但因需要使用过滤功能,无法替换为dotnet test --list-tests

相关错误信息

执行命令时会出现如下加载错误,但部分能正常识别测试的程序集也会报此错误,当前仅关注--explore功能是否可用:

Unable to load one or more of the requested types.
Could not load file or assembly 'System.Data.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Reference assemblies should not be loaded for execution.  They can only be loaded in the Reflection-only loader context. (0x80131058)

内容的提问来源于stack exchange,提问作者Kurt

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.13 23:09:57