Notes from the ASP.NET Community Standup – April 26, 2016

This is the next in a series of blog posts that will cover the topics discussed in the ASP.NET Community Standup. The community standup is a short video-based discussion with some of the leaders of the ASP.NET development teams covering the accomplishments of the team on the new ASP.NET Core framework over the previous week. Within 30 minutes, Scott HanselmanDamian EdwardsJon Galloway and an occasional guest or two discuss new features and ask for feedback on important decisions being made by the ASP.NET development teams.

Each week the standup is hosted live on Google Hangouts and the team publishes the recorded video of their discussion to YouTube for later reference. The guys answer your questions LIVE and unfiltered. This is your chance to ask about the why and what of ASP.NET! Join them each Tuesday on live.asp.net where the meeting’s schedule is posted and hosted.

This week’s meeting is below:

During the ‘pre-show’ Scott shared that he’s working with ‘the boys’ to build a GameBoy from a Raspberry Pi and a touch screen.  Scott also showed us some connectors and a micro-projector he has that enable him to project video from his phone.

Format change:  I’m going to be working with Scott to build out an FAQ of typical questions we receive that you can search.  We’ve heard that the Q+A segment can drag on, so instead, we’re going to drive more interesting demos.

Damian updated the live.asp.net website using the latest RC2 private tooling build to see how much worked and what the process is to upgrade a simple web application from RC1 to RC2.  In this demo, Damian is going to review those changes in the GitHub commit to accomplish this update.  The most difficult thing to convert, as reported by Damian was the update of a TagHelper that would handle Html.Partial calls by reaching into the ViewEngine.  This is not a typical implementation, and most people will not have that.

Damian started by updating the project’s local NuGet.config file to reference the nightly build feed of ASP.NET Core.  This ensures that he will install the latest RC2 versions of packages that are available and been through some testing on the Microsoft CI services.  Similarly, he updated global.json to reflect a new version of the framework.

A side goal of this update was to convert from .NET Framework to .NET Core and Damian found a few libraries that were not yet available in .NET Core.  To get these libraries updated, he used a new feature in the project.json notation to effectively lie to NuGet about which framework the project was built with.  In the frameworks element of project.json, Damian added the imports element with some portable target frameworks in an attempt to get dotnet to compile and run with the libraries he was using previously.

A major change to the code was to change all namespace references from *AspNet* to *AspNetCore*

The most noticeable change to the structure of the project is the introduction of the Program class with the public static void Main method.  Starting with ASP.NET Core RC2, web projects are formatted and structured similar to console applications.  The Main method is the entry point for the application and boots the ASP.NET host.  That host gives you the dependency injection and runs your startup class.  At the point that the Main method calls host.Run(), the web application launches and takes control of the process.  The process now looks like the following:

Environment variable names changed, and now begin with “AspNetCore_” instead of “Hosting:”.  You can see this change in the live.asp.net launchSettings.json file.  Visual Studio uses this file to determine how to configure and start the environment when debugging.  The environment variable separator was changed from a colon “:” to an underscore “_” to better support Linux and Powershell.  If you use a double-underscore “__” in your variable name, it will create a hierarchy in the configuration.

There are other changes made to accommodate the change from the .NET Framework to the .NET Core Framework.  One such change accounted for the lack of a ConvertTimeUtc method on the TimeZoneInfo object by calling the ConvertTime method with the UTC timezone. Another change Damian detailed is the lack of a Stream opening with a pathname.  To get around this limitation, Damian creates StreamWriters and StreamReaders by passing in a File.OpenWrite() argument to their constructors.  Scott and Damian questioned why some of these overloads are dropped between .NET Framework and .NET Core, and those questions are being heard and discussed by the team.

Most of these API changes had announcements declaring the breaking change in the issue list of the GitHub ASP.NET Announcements repository.  During this period of daily builds, we recommend you reference this list of changes to help identify where your code will need to be updated.

There were a number of other API / namespace rename operations that were done as part of the polish being applied in preparation for RTM.  Some of these that Damian highlighted include:

This post is a quick dump of the process Damian went through.  There is a formal document coming from the team that details how to do this migration.  Join us every Tuesday, and we’ll discuss more about ASP.NET.