Announcing Preview 1 of ASP.NET MVC 5.2.4, Web API 5.2.4, and Web Pages 3.2.4
Today we are releasing Preview 1 of ASP.NET MVC 5.2.4, Web API 5.2.4, and Web Pages 3.2.4 on NuGet. This release contains some minor bug fixes and a couple of new features specifically targeted at enabling .NET Standard support for the ASP.NET Web API Client.
You can find the full list of features and bug fixes for this release in the release notes.
To update an existing project to use this preview release run the following commands from the NuGet Package Manager Console for each of the packages you wish to update:
Install-Package Microsoft.AspNet.Mvc -Version 5.2.4-preview1 Install-Package Microsoft.AspNet.WebApi -Version 5.2.4-preview1 Install-Package Microsoft.AspNet.WebPages -Version 3.2.4-preview1
ASP.NET Web API Client support for .NET Standard The
ASP.NET Web API Client package provides strongly typed extension methods for accessing Web APIs using a variety of formats (JSON, XML, form data, custom formatter). This saves you from having to manually serialize or deserialize the request or response data. It also enables using .NET types to share type information about the request or response with the server and client.
This release adds support for .NET Standard 2.0 to the ASP.NET Web API Client. .NET Standard is a standardized set of APIs that when implemented by .NET platforms enables library sharing across .NET implementations. This means that the Web API client can now be used by any .NET platform that supports .NET Standard 2.0, including cross-platform ASP.NET Core apps that run on Windows, macOS, or Linux. The .NET Standard version of the Web API client is also fully featured (unlike the PCL version) and has the same API surface area as the full .NET Framework implementation.
For example, let’s use the new .NET Standard support in the ASP.NET Web API Client to call a Web API from an ASP.NET Core app running on .NET Core. The code below shows an implementation of a
ProductsClient that uses the Web API client helper methods (
Post/PutAsJsonAsync<T>()) to get, create, update, and delete products by making calls to a products Web API:
Note that all the serialization and deserialization is handled for you. The
ReadAsAsync<T>() methods will also handle selecting an appropriate formatter for reading the response based on its content type (JSON, XML, etc.).
ProductsClient can then be used to call the Products Web API from your Razor Pages in an ASP.NET Core 2.0 app running on .NET Core (or from any .NET platform that supports .NET Standard 2.0). For example, here’s how you can use the
ProductsClient from the page model for a page that lets you edit the details for a product:
For more details on using the ASP.NET Web API Client see Call a Web API From a .NET Client (C#).
Please try out Preview 1 of ASP.NET MVC 5.2.4, Web API 5.2.4, and Web Pages 3.2.4 and let us know what you think! Any feedback can be submitted as issues on GitHub. Assuming everything with this preview goes smoothly, we expect to ship a stable release of these packages by the end of the month.