【问题标题】:updating nunit-console on command line在命令行上更新 nunit-console
【发布时间】:2017-12-18 08:44:38
【问题描述】:

我正在尝试将我的 nunit-console 版本 2.4.8 升级到最新版本或至少升级到版本 3。我在网上找到的唯一帮助是关于 Visual Studio 并在那里升级它,但我正在使用 MAC 并在我的VS 它已经有最新版本。

我认为我搜索的方式是关于命令行上的 nuget

nuget update nunit-console

但它给了我以下错误

No packages.config, project or solution file specified. Use the -self switch to update NuGet.exe.

什么是正确的命令,或者我需要采取其他方式吗?

提前致谢

【问题讨论】:

    标签: macos terminal nuget nunit nunit-console


    【解决方案1】:

    您正在尝试更新 Mono 附带的 nunit-console?您不能仅通过使用 nuget 来更新它。

    相反,我只需从 nuget 下载您想要使用的 NUnit console runner,然后使用 Mono 调用它。获取控制台运行器的一种简单方法是运行:

    nuget install NUnit.ConsoleRunner
    

    这将下载最新的 NUnit 控制台运行器并将其解压缩到:

    NUnit.ConsoleRunner.3.7.0/tools/nunit3-console.exe
    

    然后将上面的 nunit3-console.exe 运行器直接与 mono 一起使用:

    mono full/path/to/NUnit.ConsoleRunner.3.7.0/tools/nunit3-console.exe
    

    或者如果你想要一个 nunit3-console 命令,那么我会查看现有的 nunit-console 脚本/Library/Frameworks/Mono.framework/Versions/Current/Commands/nunit-console

    #!/bin/sh
    exec /Library/Frameworks/Mono.framework/Versions/5.8.0/bin/mono --debug $MONO_OPTIONS /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/4.5/nunit-console.exe "$@"
    

    然后根据此脚本创建您自己的脚本,但让它使用您下载的新 NUnit 控制台运行程序。

    您可能希望将此脚本放在其他位置而不是 /Library/Frameworks/Mono.framework/Versions/Current/Commands/ 以避免在更新 Mono 时将其删除。

    【讨论】:

    • 几乎相同的问题。我在 GAC 中有 nunit 2.4.8( /Library/Frameworks/Mono.framework/Versions/5.18.1/lib/mono/gac/nunit.framework/2.4.8.0__96d09a1eb7f44a77/nunit.framework.dll )与较新的冲突编译时来自nuget的版本。按照您的指示只会更新跑步者,我应该为 GAC 中的 .dll 做什么?
    • 这仍然给出错误Either assembly contains no tests or proper test driver has not been found.
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-03
    • 1970-01-01
    相关资源
    最近更新 更多