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组合键)跳到那里。

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

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语句将其纳入范围。

Can't find JSON

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!

Find and install latest version

Or another example:

或另一个例子:

XmlDocument

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进行输入。 如果我知道自己在做什么,则可以使用这样的东西而无需使用鼠标或离开生产线。

JObject is now usable

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应用程序。 了解更多信息并获得早期版本!

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值