Home

NuGet package MoreLinq is not recognised

Hi there,

I am fairly new to using NugetPackages in LINQPad so forgive me if I make some obvious mistakes.

My intention is to include Nuget Package "MoreLinq" and use some of the Extension Methods contained within. So I clicked on F4, searched for MoreLinq, double clicked on "Add to query" and clicked on "Add Namespace". After that I wanted to try it out and clicked together a little sample. The next picture shows what happens when I try to ese the extension method "MaxBy": it is not there!

When I click on F4 again to double check it the Nuget package was really added, I can see this:

So, I reckon it has been added successfully.

Any help is very much appreciated!

Regards,
Dirk

Comments

  • Are you sure that you added the MoreLinq namespace? What do you see when you click the 'Namespaces' tab?

  • Hi Joe,

    thanks for your answer. I tried it again and you are right: the namespaces have not been added.

    When I clcked on "Add namespaces" a window opened up and showed me three namespaces in a list. I just clicked OK and thought that by doing that I added these namespaces but in fact I didn't add any of them. When I tried it again after reading your post I was more careful and noticed the sentence "Select namespace(s) to add to the query" which indicates that I have to actively select those namespaces that I want.

    So, yes it was my fault by not reading carefully but I could imagine that others could easily fall for that as well. So my suggestion would be: when the user clicks the "Add namespaces" link that the following window opens up with all the namespaces pre-selected so that when I click OK I would have all namespaces added.

    I think this approach makes sense because:

    • 99% of the time people want all namespaces added anyway
    • They don't have to manually select all namespaces
    • It's harder fall into the trap that I fell in
    • If they only want a subset of namespaces they have to select them manually anyway, so they don't have extra work when the namespaces come pre-selected.

    I fell into this trap once so I won't do it again. But my suggestion could help others and it's easy to implement and as far as I can see, it has no downside. So, maybe you can give it a thoght.

    Regards,
    Dirk

  • Thanks for your feedback. I've added an "Add all namespaces" link label alongside the heading to the next beta to make it easier and to act as a call to action.

    Automatically adding all namespaces is not a good default because the namespace list also considers package dependencies. Sometimes these dependences are internal - for example, BenchmarkDotNet depends on the Roslyn toolchain. But you wouldn't want to add the Microsoft.CodeAnalysis.* namespaces when doing benchmarking.

Sign In or Register to comment.