在命令行上更新nunit-console

问题描述 投票:4回答:1

我正在尝试将我的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个回答
6
投票

您正在尝试更新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时将其删除。

© www.soinside.com 2019 - 2024. All rights reserved.