I’ve seen some references to nuget search, but this obviously does not work for me.
Unknown command: 'search'
NuGet.Commands.CommandException: Unknown command: 'search'
at NuGet.CommandLine.CommandManager.GetCommand (System.String commandName) [0x0004e] in <645c6b593cb64a098cc3b3e8d25f888a>:0
at NuGet.CommandLine.CommandLineParser.ParseCommandLine (System.Collections.Generic.IEnumerable`1[T] commandLineArgs) [0x00016] in <645c6b593cb64a098cc3b3e8d25f888a>:0
at NuGet.CommandLine.Program.MainCore (System.String workingDirectory, System.String args) [0x00130] in <645c6b593cb64a098cc3b3e8d25f888a>:0
I’ve also seen some references to dotnet search, but that also fails:
dotnet search Microsoft.Azure.Storage.Common
You must install or update .NET to run this application.
Framework: 'Microsoft.NETCore.App', version '2.1.0' (x64)
.NET location: /nix/store/m4y7xyqcgnv1jq83smv9v71y9f145c7r-dotnet-sdk-7.0.302
The following frameworks were found:
7.0.5 at [/nix/store/m4y7xyqcgnv1jq83smv9v71y9f145c7r-dotnet-sdk-7.0.302/shared/Microsoft.NETCore.App]
Learn about framework resolution:
To install missing framework, download:
That depends on .NET Core 2.1, which was released in 2018?
This is a .NET question, not a Nix question.
nuget search refers to
dotnet search is a .NET global tool; there is no such thing as a self-contained global tool which means it’s the luck of the dice if it works with your installed runtimes, and NuGet does not have a way to search from the command line.
You can override the tool’s hard-coded desired runtime:
> dotnet tool install --tool-path .tools dotnet-search
> DOTNET_ROLL_FORWARD=MAJOR dotnet exec .tools/.store/dotnet-search/1.0.0/dotnet-search/1.0.0/tools/netcoreapp2.1/any/dotnet-search.dll
EDIT: I appear myself to not understand how .NET target frameworks work - I haven’t explicitly verified the below but I’m not longer sure it’s true; leaving it in for posterity. Something different is happening on my machine vs yours: my machine appears to be requesting runtime 7.0.7, and yours is requesting something from the netcoreapp2.1 era.
(By the way, you also appear not to understand how .NET target frameworks work. A
netcoreapp2.1-framework tool can run on any runtime at or exceeding
netcoreapp2.1, since all such runtimes implement the
netcoreapp2.1 framework, and in particular such a tool can in principle run on the .NET 7 runtime. The thing that is wrong with this particular tool is that it has implicitly selected a runtime that is later than what you have installed, presumably because it was built with SDK 7.0.304.
dotnet --list-runtimes shows that SDK 7.0.302 gives you runtime version 7.0.5.)