Rip It Up And Start Again

A Look At The New Multiplatform ASP.NET

Front Matter

  • Introduction
  • Group Pitch
  • Approach/Background
  • Brief Overview

Why The Changes?

  • The Javascript ecosystem is the elephant in the room.
  • How does ASP.NET MVC compare?

Javascript Frameworks

  • Pros:
    • Clientside logic.
    • Don't need to hit the server to do stuff.
    • Works in all modern browsers, so works on all modern platforms.
  • Cons
    • Clientside logic.
    • Browser Javascript VMs (by design) provide a limited programming platform.

ASP.NET MVC

  • Pros
    • Serverside.
    • Has a stronger, more mature programming platform to work with.
    • Easier to secure.
  • Cons
    • Serverside.
    • Harder to make responsive applications
    • Not cross-platform. At all.
    • Built on paradigms that the web is evolving past

Wait, What About WebAPI?

  • WebAPI continues to be the best thing about ASP.NET.
    • Has matured into a good, solid, well-designed RESTful API framework.
    • Only knock against it in the server world is the Windows-only limitation.

Microsoft's Problem

  • The world outside of Microsoft-land is very different.

    • Many (most) web developers don't use Windows-only frameworks.
  • MS was actively hostile to open-source and cross-platform
    • IE made web developer's lives miserable for over a decade.
  • Webdev is suddenly very important.
    • Microsoft needs web developers more than web developers need Microsoft.

But Then

  • A lot of things happened at once.
    • Nadella became CEO.
    • OWIN/Katana were released (hosting abstraction).
    • Mono/Xamarin started taking off (multiplatform .Net)
    • A new generation of MS guys like David Fowler (SignalR creator and now ASP.NET 5 architect) started doing cool stuff.
    • Massive chunks of .NET and ASP.NET were open-sourced, and development started to move onto Github.

The New Microsoft

  • For reals this time.
  • Remember "Embrace, Extend, Exterminate"?
  • They gave up on the Exterminate part because it wasn't working.

One Requires The Other

  • So the clear push from Microsoft is to take pages from open-source projects and bring
    • Cross-platform support
    • Modularity
    • Integration with established tooling

..to the entire development platform

"You have no credibility if you try to go cross-platform and you're not open-source. If you want to go cross plat you need to go open source."

The 3 Pillars Must Change

  • IIS optional
  • Windows optional
  • Visual Studio optional
    • Not possible without reworking core aspects of Microsoft's development platform.
      • .Net Framework (The Framework)
      • ASP.NET (The Platform)
      • Visual Studio (The Tooling)

.Net

(Aka The Fork)

And Then There Were Three

  • There are currently 3 (!) officially supported .Net runtimes:
    • .Net Core 5 (The new, completely open-source, completely multiplatform one)
    • .Net 4.6 (The monolithic, Windows-only one you know and love)
    • Mono (The weird one Miguel de Icaza tried to get Linux people to use even before Microsoft cared about multiplatform)

.Net Core 5

  • Essentially a fork.
  • Why a fork?
    • Microsoft has published a lot of the existing .Net framework code already.
    • But there are (apparently) legal/business reasons they can't/won't open source it.
    • .Net 4.6 will "never be on Github"
    • Chunks of it of it just aren't portable to non-Windows platforms (Forms, etc) 

.Net Core 5

  • So we have what amounts to a new framework.
    • Much more modular, and "optimized for the cloud".
    • Open-sourced from day 1, developed out in the open on Github.
    • Multiplatform from day 1.
    • Has Roslyn-enabled features not supported by the existing framework.
  • Mandatory system-level runtime installs are gone, even on Windows.

.Net Core 5

  • You get all the features of the new Roslyn runtime with Core 5.
    • On-the-fly in-memory compilation.
    • Which if you're a developer means you won't see a discrete compile step anymore. 
  • I am sad to report that WebForms will never be supported with Core 5.
    • I am actually not sad to report that.

.Net 4.6

  • 4.x is the last of the monolithic system-level .Net releases.
    • 4.6 will get updates.
    • There are Core 5 features that will never come to 4.6.
  • .Net 4.x is the last version of .Net that will work the way you're used to.

Mono

  • 3rd party Xamarin .Net implementation.
    • Mono is a Microsoft-supported host for ASP.Net 5 apps just like Core 5 and .Net 4.6.
    • Core 5 is a bit unstable now, Mono is still the best option for Linux or OS X.
    • I also suspect MS will drop Mono when Core 5 comes fully online.
    • Currently it's 100% supported, and all the Core 5 unit tests are required to pass on Mono.

ASP.Net 5+

(Aka MVC 6)

ASP.Net

  • With .Net Core 5, you no longer need a system-level pre-installed .Net runtime.
  • Basically you get a version of .Net deployed with your app, stripped of all APIs your app doesn't use.
  • OWIN middleware is now used for everything
    • This allows you to self-host, host outside of IIS, or host inside IIS

ASP.Net

  • On ALL platforms
    • You use Nuget to install dependencies.
    • You use a command line tool to build the app.
    • You use a command line tool to run/host the app.

ASP.Net

  • dnvm - Dot Net Version Manager - download, update and change the runtime.
  • ​dnu - Dot Net Development Utility - Nuget package manager.
  • dnx - Dot Net Execution Environment - Basically like running node.exe for node apps.
  • Even Visual Studio on Windows will just invoke these tools for those operations.

ASP.Net

  • Web.config is no longer required for hosting config.
    • But you can still use it if you want
    • You can also use JSON, INI files, or just environment variables.
  • Config reader middleware will transparently handle reading config options from any of those.

ASP.Net

  • Like Core 5, all ASP.Net development is happening out in the open on Github.
  • https://github.com/aspnet/home
  • The weekly standup are public, and hosted via Google Hangouts.

Visual Studio

(Aka The Moneymaker)

Tooling

  • Multiplatform runtime and hosting doesn't get you anywhere if your tooling is platform-bound.
    • Most non-MS devs do not use MS tooling and are not GUI-only users
  • Making Visual Studio multiplatform would be an insane effort.
    • Also project configs are tightly coupled with Visual Studio
    • Non-MS devs would rather continue to use or at least interoperate with proven tooling.

Tooling

  • Microsoft is reworking the project file format.
    • Unsurprisingly, the new project files look exactly like they do in the Javascript/nodeJS world.
  • .csproj's are no more
  • Not MSBuild based.
    • A JSON file that lists stuff like dependencies and build targets.
    • No more huge lists of referenced files.
    • Folder-based includes, wildcard excludes.
    • Much trimmer and less fragile format.

Tooling

  • You can manage and build/host with command line tools.
  • Project files are no longer opaque wads of XML.
  • Built-in support for 3rd-party task runners.
  • All of this means you can use any text editor you want to develop ASP.Net apps.

Tooling

  • But of course Microsoft wants a piece of this action.
    • Visual Studio Code
    • VS Code is basically Microsoft's response to the popular crop of visually clean, powerful multiplatform text editors like Sublime Text, Atom, etc.
    • VS Code is multiplatform.
    • It's either VS Lite or a heavy text editor, depending on your viewpoint.

Tooling

  • VS Code
    • Intellisense
    • All the new .Net command line operations
      • Nuget
      • Run
      • Debug
    • Gulp task runner
    • Code lens
    • Native Git support

Tooling

  • Debugging
    • Right now, there is no good C# debugging story outside of using the real Visual Studio.
    • This may change eventually.

Summary

Embrace, Extend, Monetize

  • The .Net framework is fundamentally changing.
  • ASP.Net is fundamentally changing.
  • The tooling story is fundamentally changing.

Embrace, Extend, Monetize

  • All of this is undeniably a response to the success of the non-Microsoft webdev ecosystem.
  • Microsoft needs to win hearts and minds so it can sell them software licenses and Azure.
  • All of this makes .Net development better.

Demo!

A Look At The New Multiplatform ASP.NET

By Ben Leggett

A Look At The New Multiplatform ASP.NET

  • 1,029