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.
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.
Workaround for hung at "Configuring Extensions" on Visual Studio 2012 RC
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.
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.
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.
With NuGet 2.0 typing Install-Package JQuery.[TAB] will make a quick JSON call like this:
Which will return, in this case, 603 bytes of JSON, as it should. It's fast.
And you'll get nice Intellisense for packages.
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:
From the docs:
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.
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.
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. ;)
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...
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.
We are hoping the other companies (and others inside of Microsoft) will follow the same standard naming structure
If you haven't noticed there's a bunch of cool NuGet-specific sites and applications showing up in the wild.
© 2012 Scott Hanselman. All rights reserved.
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.
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.Workaround for hung at "Configuring Extensions" on Visual Studio 2012 RC
- Close all instances of VS
- Examine the contents of HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\ExtensionManager\PendingDeletions
- Delete the folders listed for each entry
- Delete HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\ExtensionManager\PendingDeletions
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.
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.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.
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.
With NuGet 2.0 typing Install-Package JQuery.[TAB] will make a quick JSON call like this:
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.
["jQuery.Ajax.Unobtrusive", "jQuery.ba-throttle-debounce", ..., "jQuery.LiveQuery", "jQuery.MaskedInput", "jQuery.Meow"]
And you'll get nice Intellisense for packages.
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:
<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.
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.
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.
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. ;)
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...
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.
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 |
We are hoping the other companies (and others inside of Microsoft) will follow the same standard naming structure
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.
- 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.
- 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."
- TeamCity - TeamCity 7 supports packing and publishing of Nuget packages via a NuGet plugin (thanks Eugene Petrenko!) that is now installed by default!
- Sonatype Nexus - Supports the Java Maven repository and now NuGet.
- Allows the customer to have a local copy of the entire NuGet repository
- Allow the customer to select which license types of software they support and only show them matching NuGet’s
- Allow the customer to see that the NuGet’s they are consuming do not contain code copied from other projects
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!)
WebMatrix 2 - WebMatrix not only supports NuGet but it includes the gallery as a toolbar button and uses NuGet to install additional functionality like iPhone and iPad simulators!
NuGetFeed - Create a personalized feed of packages you care about and never miss another update!
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.
© 2012 Scott Hanselman. All rights reserved.
No comments:
Post a Comment