Home > Blockchain >  "Suggest usings for types in nuget packages" - how to make my NuGet package suggested?
"Suggest usings for types in nuget packages" - how to make my NuGet package suggested?

Time:11-11

There is a feature in recent Visual Studio named "Suggest usings for types in nuget packages".

It works for many non-Microsoft packages. For example, when anywhere in your code you type JsonConvert and press Ctrl . you'll get Install package Newtonsoft.Json suggestion.

It is very convenient and time saving feature.

However - no matter how many packages I made, with full documentation, symbols, metadata and what not, they are never, ever suggested, even if only one such name exists in entire NuGet repository.

There must be a catch here. Some undocumented, or even documented but little known feature of .NET project system that allows adding some metadata so this feature would suggest the package.

Does anyone knows how to do it?

CodePudding user response:

The visual studio basically runs the NuGet package in the control of IntelliCode. The number of downloads of package matters in the "Suggest using for types in NuGet packages" option. It shows based on this.

CodePudding user response:

From the MS Dev Blog IntelliCode Package Suggestions for NuGet in Visual Studio

How it works

IntelliCode Package Suggestions use a collaborative filtering algorithm to take the context of your project, including the installed packages and project framework, to then suggest packages that are frequently included in similar projects. You can think of it like Netflix recommendations for NuGet packages. The model works best in projects with more packages because it has more context to tailor your suggestions. It will also continue to improve with each new release of Visual Studio – adapting to the latest packages and trends.

From this line we can infer suggestions are based on popularity of the package:

then suggest packages that are frequently included in similar projects
  • Related