As promised in our last blog post we’re releasing Microsoft.Net.Http as a stable NuGet package today. Yep, that’s right: You can finally start using the portable HttpClient 2.1 in production!
As we’ve discussed in previous blog posts, HttpClient is a modern networking API which makes it easy to access any resource exposed through HTTP. The HttpClient API has been available in some versions of .NET for a while now. This NuGet package makes a standard set of HttpClient APIs available across a wider array of platforms, including Windows Phone 7.5 and higher, .NET Framework 4.0 and higher, and Windows Store. This enables you to share more .NET code across these platforms.
This package also addresses one of the top User Voice requests for .NET: providing an HttpClient implementation for Portable Class Libraries (and therefore also on Windows Phone 8).
We closed this request when we posted the preview of the new HttpClient back in February. Now, with the release of a stable version, we’re excited that you now have a high-quality implementation to use and build on in your .NET projects.
This package requires Visual Studio 2010 or Visual Studio 2012, and NuGet package manager 2.5 or higher.
Changes from RC
We haven’t changed much since last week's release candidate (RC), but this is by-design. For our NuGet packages, feature work is first released in beta builds only. Once we think we matured a feature enough (based on internal testing as well as customer feedback), we release an RC. If there aren’t any major bugs, we turn (generally the same) bits into an RTM, which NuGet calls a stable release. This process helps ensure that we ship high-quality components.
We did make some very minor changes to our package metadata:
- To make the package easier to recognize as an official Microsoft component, we prefixed it with “Microsoft”.
- To improve search results, we added tags (e.g., “HTTP” and “REST”).
What’s next for HttpClient?
As I explained in my last blog post, the current release doesn’t include support for automatic decompression. One of our readers commented that each time a web request is issued without gzip support, it hurts baby seals.
We know automatic compression is an important feature for you, and we care deeply about the health of baby seals, so we are working on a portable compression library that provides this feature. Our plan is to ship a beta release of HttpClient 2.2 that includes this library very soon. As a reminder, here is our tentative release schedule:
- Mid-June: Beta of HttpClient 2.2 with automatic decompression
- End of June: RC of HttpClient 2.2 with automatic decompression
- Around July (depending on feedback): RTM of HttpClient 2.2 with automatic decompression
Community support for automatic compression
Until we release a stable version of automatic decompression that you can use in production, there are some alternatives you may want to consider. (Please note this isn’t intended to be a complete list. If you’ve developed a similar feature, let us know by posting a comment below.)
Morten Nielsen, a Microsoft Valued Professional (MVP), has provided an implementation of HttpClientHandler that has support for gzip compression. You can find the source code here:
Robert McLaws created a derived project and packaged it up as a NuGet package. You can install his NuGet package either via the package manager console:
Install-Package HttpClient.Compression –Pre
or by searching for HttpClient.Compression in the NuGet Package Manager dialog. At the time of this writing, HttpClient.Compression wasn’t available as a stable NuGet package, because the stable version of our HttpClient wasn’t released yet. I’m sure it will get updated very soon, though.
Summary
HttpClient 2.1 is now available as a stable release on NuGet. The license allows its use in production and unblocks third parties from building stable NuGet components on top of it.
You can expect a beta release of HttpClient 2.2 with support for automatic decompression very soon. Meanwhile, help protect baby seals by using one of community libraries we linked to above. If there are other community libraries available, please let us know in the comments section!