Agafonov Slava Digest about software

Cross-Platform with .NET Core

Many people mean .NET Framework when they say .NET, but there's more to it than that. .NET is an ECMA standard that has different implementations - .NET Framework Mono, Unity and now .NET Core. .NET Core is cross-platform it runs on Windows, OS X and multiple distributions of Linux. It also supports different CPU architectures. For example Linux distribution and CPU architecture will be supported soon. Goal is to make the cost of abstraction clear to developers, by implementing a pay-for-play model that makes obvious the costs that come from employing a higher-level abstraction to solve a problem. .NET core will favor performance with standard library that minimizes allocation and the overall memory footprint of your system.

Cross-platform isn’t supposed to mean the same everywhere; it means compatible but suiting each platform. Some features — like file access — are on every platform and cross-platform systems have to make those easy. But there are unique features on each platform, as well as different design and interface style; you can’t homogenize those without taking away the reasons people want to use those platforms.

I personally respect Scott, he has a done a lot to make this project real. Now he is focusing on cross-platform features, performance improvements and much more.

.NET Core is a cross-platform implementation of .NET that is primarily being driven by ASP.NET 5 workloads, but also by the need and desire to have a modern runtime that is modular and whose features and libraries can be cherry picked based on the application’s needs. NET Core consists of the CoreCLR runtime and the CoreFX framework libraries. A set of cross-platform tooling can be found in the .NET CLI. The Roslyn compiler and LLILC compiler are sibling projects that support .NET Core. These projects are active on GitHub. You can participate by creating issues or collaborate on development. The main goal of the project is to create a modular, performant and cross-platform execution environment for modern applications.

The best way to explain what .NET Core is about is to contrast it with its “cousin,” the .NET Framework, pictured above. When you install .NET Framework, you get not only the runtime, but also the entire Base Class Library (BCL) with it. It is installed centrally in a known location in Windows centrally so all programs can use it, and the libraries that come with it are also centrally available. Any .NET application that runs on Windows can thus expect a certain level of support, depending on the actual version the machine it is being ran on has installed.

This may seem like an excellent idea, mostly because it is. However, there are those scenarios, like the ASP.NET Core 1 one which we will look at below, that really do not fit well with this approach. We wanted to enable developers to make their solution fully packaged and isolated on a machine where it needs to run. That means, for instance, that when you deploy your application, you want to be in full control of the runtime, library versions and other things your application depends on.

Built for speed, ASP.NET Core 1.0 is the cross-platform Web stack for .NET core. If you want to deploy ASP.NET Web app to container on Linux you can do it. Scope of console apps is larger. Universal Windows Platform target the family of Windows 10 devices run on .NET Core. A practical question is this: If you write something on one stack, will it run on the other? Like most answers in life, it depends.  If API's are implemented then yes, but if some dependencies are not implemented it can be a problem. .NET Portability Analyzer - available as a command-line tool or Visual Studio extension and it can analyze your .dll files and generate a report on how portable your code is from the .NET Framework to .NET Core. 

ASP.NET Core 1 is a completely redesigned way of working with web applications on the Microsoft application platform. There are many new things that will come with this new release; too much to go into detail here. ASP.NET Core 1 will be cross-platform, allowing you to run web applications written for it on Linux, OS X and Windows.

ASP.NET Core 1 can use either the Core CLR or the full, desktop .NET Framework to run, depending on the need. It also has a completely revamped approach to tooling, where it is starting with a “CLI first” philosophy, thus allowing one set of tools to be used on different platforms.

But most importantly, it also allows a pay-as-you-go model, in which you only include in your web application what you really need. There is no more “packaged also” mode, where you have to struggle with large assemblies that cut into your request size and eat into your performance. With the new approach, you will be able to use only what you need/want.

.NET Core it is available on Windows Azure. You can deploy an ASP.NET 5 CoreCLR based application to Azure Websites. Even Platform Handler is available. If you're using VS2015 then you can simply publish from VS. Firstly, yes, you can happily run ASP.Net 5 core apps on Azure, but there are some gotchas. There are several ways to publish ASP.NET Core rc1 apps to an Azure Web App. These include continuous deployment with Git and publishing with Visual Studio. Post your repository's contents for specific help. app/Startup.cs - Include the Configure method. This one adds an extremely simple response handler.

using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;

namespace WebNotWar
{
    public class Startup
    {
        public void Configure(IApplicationBuilder app)
        {
            app.Run(async (context) =>
            {
                await context.Response.WriteAsync(
                    "Hello from a minimal ASP.NET Core rc1 Web App.");
            });
        }
    }
}

The best way to install .NET Core on Windows is to download the official MSI installer. This installer will install the tools and put them on your PATH. If you are using Windows 7, Windows Server 2008 or Windows Server 2012 you will also need to install Visual C++ Redistributable for Visual Studio 2012 Update 4 & Visual C++ Redistributable for Visual Studio 2015 . One of the key benefits of .NET Core is its portability. You can package and deploy the CoreCLR with your application, eliminating your application’s dependency on an installed version of .NET (e.g. .NET Framework on Windows). You can host multiple applications side-by-side using different versions of the CoreCLR, and upgrade them individually, rather than being forced to upgrade all of them simultaneously.

mkdir hwapp

cd hwapp

dotnet new

Reference

GitHub.com/dotnet/coreclr

GitHub.com/dotnet/corefx

The command line interface and tooling: GitHub.com/dotnet/cli

.NET Core: GitHub.com/dotnet/core-docs

DotNetFoundation.org/projects

http://dotnet.github.io/about/overview.html

https://channel9.msdn.com/events/build/2015?wt.mc_id=build_hp

http://dotnet.github.io/getting-started/

http://dotnet.github.io/docs/

Installing .NET Core on Windows

Installing .NET Core on Ubuntu

Installing .NET Core on OS

GitHub: https://github.com/bigfont/WebNotWa

Live: http://webnotwarapp.azurewebsites.net

Summary

As a new stack .NET Core provides some exciting capabilities that were not possible with the .NET CLI also introduces a great command-line experience that will be the foundation  of the developer experience and integrated into other tools such as Visual Studio and Visual Studio Code. .NET Core has two major components. It includes a small runtime that is built from the same codebase as the .NET Framework CLR. The .NET Core runtime includes the same GC and JIT (RyuJIT), but doesn’t include features like Application Domains or Code Access Security. The runtime is delivered via NuGet, as part of the ASP.NET 5 core package. .NET Core also includes the base class libraries. These libraries are largely the same code as the .NET Framework class libraries, but have been factored (removal of dependencies) to enable us to ship a smaller set of libraries. These libraries are shipped as System.* NuGet packages on NuGet.org. .NET Core is essentially a fork of the NET Framework whose implementation is also optimized around factoring concerns. But this is Microsoft showing an unprecedented level of transparency and willingness to take feedback about .NET. If you’ve got questions and ideas, you’ll find the .NET team on Stack Overflow and in the .NET Foundation and on GitHub, ready to talk about making .NET Core the future. The way the new .NET is being built is as significant as what’s being built into the new .NET stack.

Add comment

Loading

Copyright © 2018 - Design by FS