Straight talking 65

by Tim Anderson

Tim Anderson discusses the implications of Microsoft’s recent announcements for .NET developers.

HardCopy Issue: 65 | Published: February 27, 2015

Microsoft’s .NET Framework, the runtime and libraries which power C#, Visual Basic and F#, was first released in early 2002, and soon became the most popular approach to building business applications on Windows. The C# language is a successful blend of familiar C-like syntax and the ease of programming that comes from automatic memory management. Just-in-time compilation to native code delivered strong performance, and the ASP.NET framework for web applications worked well for Windows developers moving to internet applications. Since then, Microsoft has delivered regular updates and brought .NET to new platforms such as Windows Phone and Windows 8.

In 2015 though, there are big changes coming to the .NET world. Microsoft is splitting .NET into two streams. One, which continues to be called .NET Framework, will continue along familiar lines, being a Windows-only technology and including libraries for Windows desktop and ASP.NET. The other, called .NET Core, is an open source, cross-platform framework for Windows, Mac and Linux. The cross-platform aspect is primarily server-side, letting you run ASP.NET applications on non-Windows servers, though third-parties are free to build on .NET Core to create desktop or mobile applications.

This dual-stream path for .NET raises a host of questions. Here is what we know.

If you are doing Windows desktop development, the .NET Framework remains the only option. Microsoft is also reviving desktop development to some extent, with Windows 10 on the horizon, and work is under way to improve Windows Presentation Foundation (WPF). Windows Forms, the older desktop framework, will still be supported but its features are near frozen.

For those working with ASP.NET, it is more complex. The next version, ASP.NET 5, will run on both .NET Framework and .NET Core. Developers with cross-platform plans should choose .NET Core, while others can stick with .NET Framework for the comfort of a slower release cycle and patching via Windows Update. However, only .NET Core supports a key feature of ASP.NET 5, namely ‘app local’ deployment where the runtime and library is deployed alongside the application itself.

But what about Universal Apps, which are Visual Studio projects that compile to both Windows Phone and Store apps? Microsoft is hoping to speed adoption of Store apps in Windows 10, by allowing them to run in desktop windows so that desktop users are not forced into a tablet-oriented environment.

One of the motivations for .NET Core is to refactor the framework to support full native code compilation, a project called .NET Native. Microsoft says this is too difficult to do for the entire .NET Framework, but it has done the work for the subset that is compatible with the Windows Runtime (the Store app platform). Therefore, Store apps will use .NET Core. The intention is that .NET Native will be the norm for deploying Store apps, giving users fast start-up times.


More twists to the story

The nature of open source is that projects are constantly updated. How does that play out for developers who prioritise reliability over having the very latest cut of code, and what if a change in one library breaks some other dependent library, or introduces a security problem?


Microsoft diagram comparing .NET Framework with .NET Core.

Microsoft says it will deliver stable releases though a mechanism called distributions. “We’ll create the notion of a .NET Core distribution. This is essentially just a snapshot of all the packages in the specific version we tested,” says Program Manager Immo Landwerth in his 4 December 2014 post ‘Introducing .NET Core’ on the .NET Framework Blog. The plan is to ship distributions four times a year, which is much more rapid than .NET Framework updates.

Developers use .NET Core by installing NuGet packages, where NuGet is Visual Studio’s repository and package manager. As for security, the company says it will figure out how to deliver patches even in the case of app local deployments – but has yet to work out how.

With all the cutting-edge activity happening in .NET Core, which Landwerth says is “the foundation for all future .NET verticals”, does the .NET Framework have any future? Director of Program Management Jay Schmelzer told me, “There’s no legacy mode, maintenance mode that we intend to imply with the .NET Core announcement. We continue to believe in the full Framework and the scenarios it was created to support, and we’ll continue to innovate in that space.”
That is the official line then, but there is no doubt that innovations will come first to .NET Core, and may or may not be added to .NET Framework at some later date. Further, .NET Core has a modular design that enables some features, such as .NET Native, that can never be ported to .NET Framework. A key question is whether whatever follows ASP.NET 5 will retain its dual framework support, thus perhaps holding back what can be done with the web platform, or become a Core-only platform, leaving the .NET Framework in something close to legacy status despite Microsoft’s denial.
That said, .NET Framework users should not be anxious; Microsoft’s track record in continuing to support its runtimes is excellent.


What about client apps?

Microsoft has a poor track record with cross-platform development. Readers with long memories may recall Visual C++ 2.0 cross-development edition for the Mac in 1994, or Visual FoxPro for the Mac in 1995. There is also a long history of Office for the Mac missing key features of the Windows version.

Today the company is again supporting cross-platform development, and this time it is serious, because the pressure is more urgent. Windows 8 was a disaster when measured either by adoption – especially in businesses which have largely stayed on Windows 7 – or by the effort to create an app ecosystem to rival that of iOS and Android. Maybe Windows 10 will be more successful, but there is now little prospect of disrupting either platform. The advance of Mac in the high-end PC market continues as well, not least among developers.

This means that, from Microsoft’s perspective, it has to support all these platforms in order to succeed in key parts of its business, such as Office 365, OneDrive or Skype. Microsoft’s server platform, now extended to the cloud via Azure, is also critically important. If developers can easily create apps for multiple platforms that use services running on Azure and access SQL Server, for example, then it will be easier for Microsoft to sell these services.

It also follows that Microsoft-platform developers are under pressure to create apps for Mac, iOS and Android, rather than the Windows-only clients that might have been sufficient a few years back.
Microsoft’s Office team has taken this to heart, delivering high quality versions of Word, Excel and PowerPoint for iOS and Android. It has done this by creating a new cross-platform C++ codebase targeting iOS, Android, and Windows Store. According to a presentation at the @Scale conference in San Francisco last year, the team has achieved around 95 per cent code reuse across Android and Windows Store, for example.

Visual Studio 2015, now in preview, is full of cross-platform features. In particular:

Visual C++ now includes a compiler for Android, via the Clang/LLVM toolchain. You can create both dynamic shared libraries which you can call from Java or other toolkits, and complete Android applications using a custom user interface, such as a game. iOS support is not promised but seems likely to follow.

Visual Studio Tools for Apache Cordova (a new name to replace the equally snappy Multi-Device Hybrid Apps for Visual Studio) lets you build cross-platform apps using HTML and JavaScript. You can debug apps on iOS using either the iOS simulator or a connected device, though a Mac is required.

A new project option enticingly called ‘Build native iOS apps in C#’ redirects to Xamarin’s website, a company which provides a C# compiler for iOS, Android and Mac OS X. The link confirms the special relationship between Microsoft and Xamarin. It is also possible that parts of .NET Core will be used by Xamarin, especially as CTO and co-founder Miguel de Icaza is also on the board of the .NET Foundation, an entity set up to oversee the various open source .NET projects.

A new Android emulator for Visual Studio runs on Hyper-V, avoiding the annoyance of having to disable Hyper-V to run a fast Android emulator. The new emulator works with Visual C++, Xamarin, and Apache Cordova.

All this is on top of the cross-platform .NET Core covered above.

Can Microsoft make this work? The changes are huge, particularly in .NET, and Microsoft faces challenges not only in delivering this new technology, but also in convincing developers to take it seriously as a cross-platform tool provider. However the positive aspect is that Microsoft platform developers are being given numerous ways to deploy across several platforms while still using Visual Studio and C# or C++, and that is a development that many will welcome.

HERE Maps ad
Visual Studio 2015 Supplement Ad