Microsoft recently announced the release of the latest ASP.NET 5 Beta 5 as an in-place update to Visual Studio 2015 RC. As with any beta versions, this one too is an improvised one that fixes the bugs and one that comes with new features. A point to be noted here is that Beta 5 which replaces Beta 4 shipped with Visual Studio 2015 RC is an update to the ASP.Net runtime and not the Web Tooling features.
Here’s a lowdown on what changes developers can look out for with this release:
Changes to the .Net Execution Environment (DNX)
The Beta 5 release that is available on NuGet brings a lot of improvement to the .Net Execution Environment (DNX) that includes:
- Support for NuGet V3 feeds: The NuGet v3 feeds reads the credentials from environmental variables enabling a speedy restoration of packages.
- Support for the new Dotnet Target Framework Moniker (TFM): Building portable .Net libraries with DNX that also work on any .Net flavour that supports the package dependencies is now possible with the new Dotnet TFM.
- Removal of JSON.NET version pinning: This can come as a huge relief for developers since it essentially means that they have the flexibility to work with any updated version of JSON.NET rather than having to work with just the one that was shipped with the .NET Execution Engine. The newer versions of the JSON.NET can be installed even as the developers retain an older DNX version.
- Addition of the new IRuntimeEnvironment service: The new DNX now has an IRunTimeEnvironment service that can give you the runtime details.
Changes to ASP.Net 5
The following changes have been made:
- Added new Connection property: Developers can get all the connected information via the new connection property called Connection that adds connection information to the Httpcontext.
- Addition of New Localization abstractions and middleware, and
- Introduction of a consistent way to terminate the ASP.NET hosting using Ctrl+C: This is an improvement over the erstwhile system of using any key for termination.
Changes to the MVC 6
- The developers can now enjoy the C# 6 support, a version that is shipped with the Visual Studio 2015RC while working in Razor. This makes the coding faster, productive and lighter.
- Simplified MVC options and added top level settings: Additional app-level settings make configuration of HTML helper settings much simpler.
- New JSON helper for serializing JSON in views: The new JSON helper enables you to serialize the .NET objects to JSON while in Razor view using easy and simplified syntaxes, for instance:
- You can now use route token in route names in addition to using them in route templates. This is helpful for diagnostic purposes.
- Addition of a New ImageTagHelper: While image caching is easy, it is often a laborious task to signal the browser that the cache is not valid anymore. With the new tag helper, this process becomes much simpler and it allows the MVC to “add image filenames automatically with cache-buster version number” that makes image caching along with the application more aggressive.
- Addition of a Tag helper support for binding dictionary properties: This is a huge improvement to the tag helper framework as now “you can bind server side attributes to dictionary properties on your tag helpers”.
- Support conditionally binding tag helpers based on presence of server-side attributes: Based on the presence of server-side attributes, you can use conditionally binding tag helpers using the Attributes property on TargetElementAttribute.
As we can see, there have been a lot of API changes and in the process a lot of packages have been optimized to improve layering and reduce dependencies Developers looking to upgrade to the ASP.NET 5 Beta5 need to follow the following steps:
- Install the .NET Version Manager (DNVM) – choose the latest version or go with the preinstalled one that comes with Visual Studio 2015 RC)
- Set the DNX_FEED environment variable to https://www.nuget.org/api/v2 from a command prompt.
- Run “dnvm upgrade”
- Update your global.json to point to beta5 version of the .NET Execution Environment (DNX) in your app.
- Also update your project.json to point to the beta5 package versions
- Run “dnu restore”
- Run “dnu build” and migrate your code to beta5 as needed