【问题标题】:Why does trying to unit test with two .NET 4.0 assemblies under NUnit 2.5.4 fail?为什么尝试在 NUnit 2.5.4 下使用两个 .NET 4.0 程序集进行单元测试会失败?
【发布时间】:2010-04-17 18:42:30
【问题描述】:

我有一个 MSBuild 脚本,它使用 NUnit 在两个程序集中运行测试。这些是在 .NET Framework 3.5 上运行的,并且在很长一段时间内都能完美运行。

命令行是: (实际路径和名称已简化)

nunit-console tests1\bin\debug\tests1.dll tests2\bin\debug\tests2.dll

我已经升级到 VS2010 并且现在已经使两个测试程序集以 .NET 4.0 为目标。我也升级到 NUnit 2.5.4。

我可以使用以下内容对单个程序集进行单元测试:

nunit-console tests1\bin\debug\tests1.dll /framework=4.0.30319

它适用于tests1.dll 或tests2.dll。

如果我尝试像以前一样指定两者,现在会失败。

nunit-console tests1\bin\debug\tests1.dll tests2\bin\debug\tests2.dll /framework=4.0.30319

错误是:

Could not load file or assembly 'tests2' or one of its dependencies. The system cannot find the file specified.

我查看了 fuslogvw,它显示在 tests1\bin\debug 和 nunit-console 文件夹中搜索了 test2。即使在命令行中指定了它,它也从不搜索 tests2\bin\debug。

这是怎么回事?

【问题讨论】:

  • 它适用于新版本的 NUnit 2.5.5。似乎这是 2.5.4 版本中的错误。

标签: assemblies nunit .net-4.0 assembly-resolution


【解决方案1】:

纯属猜测,但这听起来像是新版本 NUnit 中的回归。

您同时改变了两件事 - 您是否尝试过使用以前工作的旧版本 NUnit 运行测试?这应该可以为您提供有关问题所在的线索。

【讨论】:

  • 没有机会使用 2.5.3 进行测试(我在某处读到的可以使用 4.0),因为我忙了一个星期,不得不暂时离开,现在我有时间再看一遍,有一个新版本的 NUnit (2.5.5) 可以工作。
猜你喜欢
  • 1970-01-01
  • 2012-07-03
  • 2021-07-17
  • 2013-06-26
  • 2020-11-07
  • 1970-01-01
  • 2015-05-20
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多