在命令行更新 nunit-console

updating nunit-console on command line

我正在尝试将我的 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.

什么是正确的命令,或者我需要走其他路吗?

提前致谢

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

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

nuget install NUnit.ConsoleRunner

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

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

然后要么直接用上面的nunit3-console.exe 运行ner和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 时被删除。