"Suggest usings for types in nuget packages" - 如何建议我的 NuGet 包?

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

最近 Visual Studio 中有一个名为“建议在 nuget 包中使用类型”的功能。

它适用于许多非 Microsoft 软件包。例如,当您在代码中的任何位置键入 JsonConvert 然后按 Ctrl+. 你会得到 Install package Newtonsoft.Json 建议。

非常方便省时的功能。

但是 - 无论我做了多少包,都有完整的文档、符号、元数据 什么不是,他们从来没有,曾经被建议过,即使只有一个这样的名字存在于整个 NuGet 存储库。

这里肯定有问题。一些未记录,甚至记录但鲜为人知的功能 允许添加一些元数据的 .NET 项目系统,因此此功能会建议 包裹。

有人知道怎么做吗?

visual studio基本都是在IntelliCode的控件中运行NuGet包。 在“建议使用 NuGet 包中的类型”选项中,包的下载次数很重要。基于此显示。

来自 MS 开发博客 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.

从这一行我们可以推断出建议是基于软件包的受欢迎程度:

then suggest packages that are frequently included in similar projects