NuGet 2.0(.NET Package Manager)发布-立即升级,这就是原因

Before we get started, take a second and head over to http://nuget.org and click Install NuGet. Actually, just do it from here. I'll wait.

在开始之前,花点时间前往http://nuget.org并单击Install NuGet 。 实际上,只需从这里开始。 我会等。

It's a 2.5 meg VSIX file and will take just a minute to install. It'll work on Visual Studio 2010 SP1 as well as Visual Studio 2012 RC. If you have them all installed at the same time, NuGet will prompt you to install in all of them if you like.

这是一个2.5兆的VSIX文件,安装只需一分钟。 它将在Visual Studio 2010 SP1和Visual Studio 2012 RC上运行。 如果您同时安装了它们,NuGet会根据需要提示您安装所有它们。

您可能遇到的奇怪问题 (Weird Issues you might hit)

If you are an early adopter and are testing Visual Studio 2012 RC, first, thanks. If you see a dialog box on VS2012RC that says "Configuring Extensions" and seems to sit forever, we have a bug that was fixed for RTM that is starting to surface more frequently with the recent NuGet update. The bug is a race condition that occurs intermittently when a user updates his extensions in the RC release.

如果您是早期采用者并且正在测试Visual Studio 2012 RC,首先,谢谢。 如果您在VS2012RC上看到一个对话框,上面显示“配置扩展”并且似乎永远存在,那么我们已经修复了RTM的一个错误,该错误在最近的NuGet更新中开始越来越频繁地出现。 该错误是一种竞争状态,当用户在RC版本中更新其扩展时会间歇性地发生。

Workaround for hung at "Configuring Extensions" on Visual Studio 2012 RC

在Visual Studio 2012 RC上的“配置扩展”上挂起的解决方法

  1. Close all instances of VS

    关闭VS的所有实例
  2. Examine the contents of HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\ExtensionManager\PendingDeletions

    检查HKEY_CURRENT_USER \ Software \ Microsoft \ VisualStudio \ 11.0 \ ExtensionManager \ PendingDeletions的内容
  3. Delete the folders listed for each entry

    删除为每个条目列出的文件夹
  4. Delete HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\ExtensionManager\PendingDeletions

    删除HKEY_CURRENT_USER \ Software \ Microsoft \ VisualStudio \ 11.0 \ ExtensionManager \ PendingDeletions

99.9% of upgrades or installs will work just fine. If you see any other issues, run Visual Studio once as Administrator, go to Tools | Extensions Manager and uninstall NuGet, then install again.

99.9%的升级或安装就可以了。 如果您发现任何其他问题,请以管理员身份运行一次Visual Studio,然后转到“工具” |“工具”。 扩展管理器并卸载NuGet,然后再次安装

The most common installation issue is a certificate mismatch with Visual Studio 2010 SP1. Unfortunately this one isn't NuGet's bug but you can get a Visual Studio hotfix here to fix it once and for all - http://bit.ly/vsixcertfix This should be in Windows Update one day, I hope. Either installing that hotfix or uninstalling/reinstalling as admin will fix the issue for NuGet.

最常见的安装问题是证书与Visual Studio 2010 SP1不匹配。 不幸的是这个人是不是的NuGet的错误,但你可以在这里得到一个Visual Studio修复程序来一次解决它,并为所有- http://bit.ly/vsixcertfix这应该是Windows更新有一天,我的希望。 安装该修补程序或以管理员身份卸载/重新安装均可解决NuGet的问题。

已修复的问题和新功能 (Fixed Issues and New Features)

Here's a query to the complete list of the 80 issues that were fixed in Version 2.0 of NuGet. NuGet has seen over 14 MILLION package downloads and there are over 6,000 unique packages in the gallery. You can see the updated stats anytime at http://stats.nuget.org.

这是对NuGet 2.0版中已修复的80个问题完整列表的查询。 NuGet已经下载了超过1400万个软件包,并且画廊中有6,000多个独特的软件包。 您可以随时在http://stats.nuget.org上查看更新的统计信息。

The best fix, and the one I have personally been pushing the most on was this Issue: NuGet PowerShell Tab Completion is SLOW over a slow connection. If you are on a slow collection (I'm talking to you, New Zealand) or just appreciate speed, this is reason enough to upgrade NuGet.

最好的解决方法,也是我个人最力求解决的问题,是此问题:通过慢速连接,NuGet PowerShell选项卡的完成速度很慢。 如果您的收藏速度较慢(我正在与您交谈,新西兰)或只是欣赏速度,这就是升级NuGet的充分理由。

Before, typing Install-Package jQuery.[TAB] would cause an HTTP call to go to OData that would return more data than was required. I'm always pushing for folks who are not in the US on 35 megabit connections. Often because I'm over there to, sucking data through 3G.

在此之前,键入Install-Package jQuery。[TAB]将导致HTTP调用转到OData,该返回的数据将超过所需的数据。 我一直在为那些不在美国使用35兆位连接的人提供服务。 通常是因为我在那儿通过3G吸收数据。

With NuGet 2.0 typing Install-Package JQuery.[TAB] will make a quick JSON call like this:

在NuGet 2.0中,键入Install-Package JQuery。[TAB]将进行如下所示的快速JSON调用:

GET /api/v2/package-ids?partialId=jQuery. HTTP/1.0

Which will return, in this case, 603 bytes of JSON, as it should. It's fast.

在这种情况下,它将返回603字节的JSON,这应该是正确的。 它很快。

["jQuery.Ajax.Unobtrusive", 
"jQuery.ba-throttle-debounce",
...,
"jQuery.LiveQuery",
"jQuery.MaskedInput",
"jQuery.Meow"]

And you'll get nice Intellisense for packages.

而且您会获得不错的Intellisense软件包。

新的功能 (New Features)

Not only is NuGet 2.0 faster, but there's some new features like dependency grouping by target framework. You can vary your dependences such that one package can service .NET 2 and .NET 4 but each target framework requires a different bunch of packages. Here's a example:

NuGet 2.0不仅速度更快,而且还有一些新功能,例如按目标框架进行的依赖关系分组。 您可以改变依赖性,以使一个程序包可以服务.NET 2和.NET 4,但每个目标框架都需要不同的程序包。 这是一个例子:

<dependencies> 
<group>
<dependency id="RouteMagic" version="1.1.0" />
</group>

<group targetFramework="net40">
<dependency id="jQuery" />
<dependency id="WebActivator" />
</group>

<group targetFramework="sl30">
</group>
</dependencies>

From the docs:

文档

Note that a group can contain zero dependencies. In the example above, if the package is installed into a project that targets Silverlight 3.0 or later, no dependencies will be installed. If the package is installed into a project that targets .NET 4.0 or later, two dependencies, jQuery and WebActivator, will be installed. If the package is installed into a project that targets an early version of these 2 frameworks, or any other framework, RouteMagic 1.1.0 will be installed. There is no inheritance between groups. If a project's target framework matches the targetFramework attribute of a group, only the dependencies within that group will be installed.

请注意,组可以包含零个相关性。 在上面的示例中,如果将软件包安装到针对Silverlight 3.0或更高版本的项目中,则不会安装任何依赖项。 如果将软件包安装到针对.NET 4.0或更高版本的项目中,则会安装两个依赖项jQuery和WebActivator。 如果将软件包安装到针对这两个框架或任何其他框架的早期版本的项目中,则将安装RouteMagic 1.1.0。 组之间没有继承。 如果项目的目标框架与组的targetFramework属性匹配,则仅安装该组内的依赖项。

Even better, you can now group your PowerShell scripts as well as your content files by target framework. Specific scripts can run depending on your versions and specific content files can be included. This uses the same directory hierarchy you are already using for dependencies only now it works for /content and /tools as well.

更好的是,您现在可以按目标框架对PowerShell脚本以及内容文件进行分组。 根据您的版本,可以运行特定的脚本,并且可以包含特定的内容文件。 这将使用与依赖关系相同的目录层次结构,直到现在它也适用于/ content和/ tools。

启用“允许NuGet在构建过程中下载缺少的软件包”可以使您的生活更轻松 (Turn on "Allow NuGet to download missing packages during build" to make your life easier)

Finally, do be aware that you have to explicitly give the OK to "restore packages" at least once, in order to enable NuGet to fetch a bunch of dependencies for you. Often you'll get a large project that you want to compile and perhaps that project includes a packages.config but not the packages itself (you don't want check your binary packages into source control, for example) so NuGet will restore missing packages when it's time to build. You only need to do this once to satisfy the lawyers.

最后,请注意,您必须明确地给OK至少一次“恢复软件包”,以使NuGet能够为您获取一堆依赖项。 通常,您会得到一个要编译的大型项目,并且该项目可能包含packages.config,而不包含软件包本身(例如,您不希望将二进制软件包检查到源代码管理中),因此NuGet将恢复丢失的软件包什么时候该建造。 您只需要这样做一次就可以使律师满意

功能UI功能的先睹为快(感谢Mads!) (Sneak Peak of Feature UI Features (thanks Mads!))

You know the new Ctrl-Q "search all commands" feature in Visual Studio 2012? I've seen a daily build of a possible improvement to NuGet on Mads' computer that not only searched Visual Studio local commands, but also the Visual Studio Gallery AND NuGet Packages. Leave a comment if you like this feature and I'll put pressure on Mads. Or, you will. ;)

您知道Visual Studio 2012中新的Ctrl-Q“搜索所有命令”功能吗? 我已经在Mads的计算机上看到了对NuGet的可能改进的日常构建,不仅可以搜索Visual Studio本地命令,还可以搜索Visual Studio Gallery和NuGet包。 如果您喜欢此功能,请发表评论,我会向Mads施加压力。 或者,您会的。 ;)

大包装更名 (The Great Package Rename)

We've changed the names of a BUNCH of packages (and forwarded the old names) so there's a little more logic to the Microsoft ones, at least. For example, here's the autocomplete for Microsoft.AspNet...

我们已经更改了BUNCH软件包的名称(并转发了旧名称),因此至少与Microsoft的逻辑有所不同。 例如,这是Microsoft.AspNet的自动完成功能...

With this RC release, all of the NuGet packages involved in the ASP.NET products were renamed. Internally we called it the "Big Package Rename of 2012." Here is a mapping of old package names to new package names. In this list, the old names refer to prior versions of the products, including the Beta releases that shipped with VS 11 Beta.

在此RC版本中,ASP.NET产品中涉及的所有NuGet软件包都被重命名。 在内部,我们将其称为“ 2012年大包装重命名”。 这是旧软件包名称到新软件包名称的映射。 在此列表中,旧名称是指产品的早期版本,包括VS 11 Beta附带的Beta版本。

OLD PACKAGE NEW PACKAGE
AspNetMvc Microsoft.AspNet.Mvc
AspNetRazor.Core Microsoft.AspNet.Razor
AspNetWebApi Microsoft.AspNet.WebApi
AspNetWebApi.Core Microsoft.AspNet.WebApi.Core
AspNetWebApi.SelfHost Microsoft.AspNet.WebApi.SelfHost
AspNetWebPages.Core Microsoft.AspNet.WebPages
AspNetWebPages Microsoft.AspNet.WebPages.Administration
jQuery.Ajax.Unobtrusive Microsoft.jQuery.Unobtrusive.Ajax
jQuery.Validation.Unobtrusive Microsoft.jQuery.Unobtrusive.Validation
Microsoft.Web.Optimization Microsoft.AspNet.Web.Optimization
SqlServerCompact Microsoft.SqlServer.Compact
System.Net.Http Microsoft.Net.Http
System.Net.Http.Formatting Microsoft.AspNet.WebApi.Client
System.Web.Providers Microsoft.AspNet.Providers
System.Web.Providers.Core Microsoft.AspNet.Providers.Core
System.Web.Providers.LocalDb Microsoft.AspNet.Providers.LocalDb
System.Web.Providers.SqlCE Microsoft.AspNet.Providers.SqlCE
旧包装 新包装
AspNetMvc Microsoft.AspNet.Mvc
AspNetRazor.Core Microsoft.AspNet.Razor
AspNetWebApi Microsoft.AspNet.WebApi
AspNetWebApi.Core Microsoft.AspNet.WebApi.Core
AspNetWebApi.SelfHost Microsoft.AspNet.WebApi.SelfHost
AspNetWebPages.Core Microsoft.AspNet.WebPages
AspNetWebPages Microsoft.AspNet.WebPages.Administration
jQuery.Ajax。不显眼 Microsoft.jQuery.Unobtrusive.Ajax
jQuery.Validation.Unobtrusive Microsoft.jQuery.Unobtrusive.Validation
Microsoft.Web.Optimization Microsoft.AspNet.Web.Optimization
SqlServerCompact Microsoft.SqlServer.Compact
System.Net.Http Microsoft.Net.Http
System.Net.Http.Formatting Microsoft.AspNet.WebApi.Client
System.Web.Providers Microsoft.AspNet.Providers
System.Web.Providers.Core Microsoft.AspNet.Providers.Core
System.Web.Providers.LocalDb Microsoft.AspNet.Providers.LocalDb
System.Web.Providers.SqlCE Microsoft.AspNet.Providers.SqlCE

We are hoping the other companies (and others inside of Microsoft) will follow the same standard naming structure

我们希望其他公司(以及Microsoft内部的其他公司)将遵循相同的标准命名结构

托管您自己的提要(以及社区中的其他NuGet发现)(Hosting your own Feeds (and other NuGet sightings in the community))

If you haven't noticed there's a bunch of cool NuGet-specific sites and applications showing up in the wild.

如果您没有注意到,则有大量酷炫的特定于NuGet的网站和应用程序在野外出现。

  • MyGet - Create and host your own NuGet feed in the cloud. Host for your company, add security, privileges and more. Great for companies as well as automated build systems.

    MyGet-在云中创建并托管您自己的NuGet feed。 为您的公司托管,添加安全性,特权等。 非常适合公司以及自动构建系统。

  • SymbolSource - "SymbolSource is an integrated solution for hosting and browsing code releases - specifically, but not only, NuGet and OpenWrap packages. It's true power, however, comes from implementing the srcsrv protocol, which allows Visual Studio and other compatible software to download on-demand symbol (PDB) and source files from SymbolSource."

    SymbolSource- “ SymbolSource是用于托管和浏览代码版本的集成解决方案-特别但不仅限于NuGetOpenWrap软件包。但是,其真正的强大功能来自实现srcsrv协议,该协议允许Visual Studio和其他兼容软件下载需求符号(PDB)和来自SymbolSource的源文件。”

  • TeamCity - TeamCity 7 supports packing and publishing of Nuget packages via a NuGet plugin (thanks Eugene Petrenko!) that is now installed by default!

    TeamCity -TeamCity 7支持通过NuGet插件打包和发布Nuget软件包(感谢Eugene Petrenko !),该插件现已默认安装

  • Sonatype Nexus - Supports the Java Maven repository and now NuGet.

    Sonatype Nexus-支持Java Maven存储库,现在支持NuGet。

    • Allows the customer to have a local copy of the entire NuGet repository

      允许客户拥有整个NuGet存储库的本地副本
    • Allow the customer to select which license types of software they support and only show them matching NuGet’s

      允许客户选择他们支持的软件许可类型,并仅显示与NuGet匹配的软件
    • Allow the customer to see that the NuGet’s they are consuming do not contain code copied from other projects

      允许客户看到他们正在使用的NuGet不包含从其他项目复制的代码

    Sonatype Nexus - Supports the Java Maven repository and now NuGet.

    Sonatype Nexus-支持Java Maven存储库,现在支持NuGet。

  • NuGet Server written in Java - Eugene created a small NuGet server that you can run under Linux and Java 1.6. It's all part of the larger TeamCity NuGet support and on GitHub as well as NuGet itself (inception!)
    用Java编写的NuGet服务器-Eugene创建了一个小型的NuGet服务器,您可以在Linux和Java 1.6下运行它。 这是 更大的TeamCity NuGet支持的一部分, 并且在GitHub上以及 NuGet本身都是这样(开始!)。
  • WebMatrix 2 - WebMatrix not only supports NuGet but it includes the gallery as a toolbar button and uses NuGet to WebMatrix 2 -WebMatrix不仅支持NuGet,而且还包括图库作为工具栏按钮,并使用NuGet install additional functionality like iPhone and iPad simulators! 安装其他功能,例如iPhone和iPad模拟器
  • NuGetFeed - Create a personalized feed of packages you care about and never miss another update! NuGetFeed-创建您关注的软件包的个性化Feed,永远不会错过任何更新!
  • ProGet is an NuGet repository for the enterprise, includes LDAP-based permissions and scoped feeds for multiple teams. Host private NuGet packages, as well as cache and filter other repositories. Free edition available. ProGet是企业的NuGet存储库,包括基于LDAP的权限和多个团队的作用域提要。 托管私有的NuGet程序包,以及缓存和筛选其他存储库。 提供免费版本。

翻译自: https://www.hanselman.com/blog/nuget-20-net-package-manager-released-go-upgrade-now-and-heres-why

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值