使用 Mono 运行 nunit-console.exe 的问题

发布于 2024-09-03 17:21:58 字数 1221 浏览 9 评论 0原文

我可以为 NUnit NUnit test under mono 制作一个 dll,但是当我尝试运行时nunit-console.exe 我收到以下错误消息。

Runtime Environment - 
   OS Version: Unix 10.3.0.0
  CLR Version: 2.0.50727.1433 ( 2.6.4 (tarball Thu Apr 22 13:24:33 MDT 2010) )

ProcessModel: Default    DomainUsage: Single
Execution Runtime: mono-2.0

** (/Users/smcho/bin/NUnit-2.5.5.10112/bin/net-2.0/nunit-console.exe:36800): WARNING **: The following assembly referenced from /private/var/folders/m4/m4u1hmP+FHOQaiZbHj1UCk+++TI/-Tmp-/nunit20/ShadowCopyCache/36800_634111616836311880/Tests_-22323139/assembly/shadow/54274fc2/118e035c_45a94c9e_00000001/mut.dll could not be loaded:
     Assembly:   nunit.framework    (assemblyref_index=1)
     Version:    2.5.5.10112
     Public Key: 96d09a1eb7f44a77
System error: Invalid argument


** (/Users/smcho/bin/NUnit-2.5.5.10112/bin/net-2.0/nunit-console.exe:36800): WARNING **: Could not load file or assembly 'nunit.framework, Version=2.5.5.10112, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies.

可能出了什么问题?我在 /Users/smcho/bin/NUnit-2.5.5.10112/bin/net-2.0/framework 下有 nunit.framework.dll,但它似乎不知道这一点。

I could make a dll for NUnit NUnit test under mono, but when I tried to run in with nunit-console.exe I get the following error message.

Runtime Environment - 
   OS Version: Unix 10.3.0.0
  CLR Version: 2.0.50727.1433 ( 2.6.4 (tarball Thu Apr 22 13:24:33 MDT 2010) )

ProcessModel: Default    DomainUsage: Single
Execution Runtime: mono-2.0

** (/Users/smcho/bin/NUnit-2.5.5.10112/bin/net-2.0/nunit-console.exe:36800): WARNING **: The following assembly referenced from /private/var/folders/m4/m4u1hmP+FHOQaiZbHj1UCk+++TI/-Tmp-/nunit20/ShadowCopyCache/36800_634111616836311880/Tests_-22323139/assembly/shadow/54274fc2/118e035c_45a94c9e_00000001/mut.dll could not be loaded:
     Assembly:   nunit.framework    (assemblyref_index=1)
     Version:    2.5.5.10112
     Public Key: 96d09a1eb7f44a77
System error: Invalid argument


** (/Users/smcho/bin/NUnit-2.5.5.10112/bin/net-2.0/nunit-console.exe:36800): WARNING **: Could not load file or assembly 'nunit.framework, Version=2.5.5.10112, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies.

What might be wrong? I have nunit.framework.dll under /Users/smcho/bin/NUnit-2.5.5.10112/bin/net-2.0/framework, but it doesn't seem to know about this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不喜欢何必死缠烂打 2024-09-10 17:21:58

这是在 Mono 中使用 NUnit 的另一个令人沮丧的点。据我所知,您需要将所有丢失的文件(不仅仅是 nunit.framework.dll)放在与 nunit- 相同的目录中控制台.exe

mononunit-console.exe 中可能有一个命令行选项来指定另一个目录来搜索丢失的 DLL - 我不确定。除此之外,您必须将丢失的 DLL 复制到与 nunit-console.exe 相同的文件夹中,或者您必须 cd 到框架中 文件夹并使用 mono ../nunit-console.exe /path/to/my/tests.dll

This is another frustrating point about using NUnit in Mono. As far as I've been able to tell, you need to have all of those missing files (there will be more than just nunit.framework.dll) in the same directory as nunit-console.exe.

There might be a command line option either in mono or nunit-console.exe to specify another directory to search for missing DLLs -- I'm not sure. Barring that, you'll have to copy the missing DLLs into the same folder as nunit-console.exe, or you'll have to cd into the framework folder and use mono ../nunit-console.exe /path/to/my/tests.dll

怪我闹别瞎闹 2024-09-10 17:21:58

安装 nuget 后,您可以使用它来安装 nunit.console,如下所示:
(这来自我的 .circlci/config.yml 文件)

- run: mono --runtime=v4.0 nuget.exe install nunit.console
- run: msbuild MySolution.sln
- run: mono --runtime=v4.0 NUnit.ConsoleRunner.3.12.0/tools/nunit3-console.exe FirstModule.Tests/bin/Debug/FirstModule.Tests.dll
- run: mono --runtime=v4.0 NUnit.ConsoleRunner.3.12.0/tools/nunit3-console.exe SecondModule.Tests/bin/Debug/SecondModule.Tests.dll

诀窍是指定 NUnit.ConsoleRunner 的完整路径并注意 - 更改为 .按版本 3

Once nuget is installed, you can use it to install nunit.console like so:
(This is from my .circlci/config.yml file)

- run: mono --runtime=v4.0 nuget.exe install nunit.console
- run: msbuild MySolution.sln
- run: mono --runtime=v4.0 NUnit.ConsoleRunner.3.12.0/tools/nunit3-console.exe FirstModule.Tests/bin/Debug/FirstModule.Tests.dll
- run: mono --runtime=v4.0 NUnit.ConsoleRunner.3.12.0/tools/nunit3-console.exe SecondModule.Tests/bin/Debug/SecondModule.Tests.dll

The trick is to specify the entire path for the NUnit.ConsoleRunner and to watchout for the - changing into a . by version 3

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文