Visual Studio 2017可以自动为未知类型推荐NuGet程序包

There's a great feature in Visual Studio 2015.3 and Visual Studio 2017 that is turned off by default. It does use about ~10 megs of memory but it makes me so happy that I turn it on.

Visual Studio 2015.3和Visual Studio 2017中有一个很棒的功能,默认情况下处于关闭状态。 它确实使用了大约10兆的内存,但是让我很高兴能打开它。

It's under C# | Advanced in Tools Options. Or you can just type "Advanced" in the Quick Launch Bar (via Ctrl+Q if you like) to jump there.

在C#下| 工具选项中的高级。 或者,您也可以在快速启动栏中键入“高级”(如果需要,可以通过Ctrl + Q组合键)跳到那里。

Visual Studio 2017可以自动为未知类型推荐NuGet程序包

I turn on "Suggest usings for types in NuGet packages" and "Suggest usings for types in reference assemblies."

我打开“ NuGet包中类型的建议用法”和“参考程序集中的类型的建议用法”。

For example, if I am typing some code and start referencing a Type that isn't in my project but could be...you know how sometimes you just need a using statement to bring in a namespace? In this Web App, I already have Json.NET so it recommends a using statement to bring it into scope.

例如,如果我输入一些代码并开始引用不在我的项目中但可能是...的Type,您知道有时您只需要使用using语句来引入名称空间吗? 在此Web应用程序中,我已经拥有Json.NET,因此建议使用using语句将其纳入范围。

Visual Studio 2017可以自动为未知类型推荐NuGet程序包

But in this Console App, I have no packages beyond the defaults. When I start using a type like JObject from a popular NuGet, Visual Studio can offer to install Json.NET for me!

但是在此控制台应用程序中,我没有超出默认值的软件包。 当我从流行的NuGet开始使用类似JObject的类型时,Visual Studio可以为我安装Json.NET!

Visual Studio 2017可以自动为未知类型推荐NuGet程序包

Or another example:

或另一个例子:

Visual Studio 2017可以自动为未知类型推荐NuGet程序包

And then I can immediately continue typing with intellisense. If I know what I'm doing, I can bring in something like this without ever using the mouse or leaving the line.

然后,我可以立即继续使用intellisense进行输入。 如果我知道自己在做什么,则可以使用这样的东西而无需使用鼠标或离开生产线。

Visual Studio 2017可以自动为未知类型推荐NuGet程序包

Good stuff! 

好东西! 



Sponsor: Check out JetBrains Rider: a new cross-platform .NET IDE. Edit, refactor, test, build and debug ASP.NET, .NET Framework, .NET Core, or Unity applications. Learn more and get access to early builds!

赞助商:查看JetBrains Rider :一个新的跨平台.NET IDE 。 编辑,重构,测试,构建和调试ASP.NET,.NET Framework,.NET Core或Unity应用程序。 了解更多信息并获得早期版本!

关于斯科特 (About Scott)

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

斯科特·汉塞尔曼(Scott Hanselman)是前教授,前金融首席架构师,现在是演讲者,顾问,父亲,糖尿病患者和Microsoft员工。 他是一位失败的单口相声漫画家,一个玉米种植者和一本书的作者。

Visual Studio 2017可以自动为未知类型推荐NuGet程序包
Visual Studio 2017可以自动为未知类型推荐NuGet程序包
Visual Studio 2017可以自动为未知类型推荐NuGet程序包
About   关于 Newsletter 时事通讯
Hosting By 主持人
Visual Studio 2017可以自动为未知类型推荐NuGet程序包

翻译自: https://www.hanselman.com/blog/visual-studio-2017-can-automatically-recommend-nuget-packages-for-unknown-types