It’s been a quite while since ASP.NET Core is released. And ASP.NET Core is completely different from its previous version. In fact, it completely re-written to make it fast, better, modular, cross platform support. So here is quick and short summary of what’s changed in ASP.NET Core compared to all its previous versions.
Here is what’s changed in ASP.NET Core
[UPDATE: ASP.NET Core 2.0 is out. Please read What’s new in ASP.NET Core 2.0
- The first and most important change is that “ASP.NET Core is open source and cross platform.”
- ASP.NET Core works with two runtime environment (.NET Core and .NET Framework). .NET core is for all platforms (windows, linux and OSx) where .NET framework is for windows.
- ASP.NET Core project is now much cleaner. When you create a new project, it includes only required dependencies.
- .NET Platform Standard is the new approach for addressing real binary portability with PCL.
- ASP.NET Core applications are built and run using the new .NET Execution Environment (DNX). Every ASP.NET Core project is a DNX project. There are two main flavors, DNX 4.6.X (the full framework) and DNX Core 5.0 (the light-weight open source .NET version that also runs on Linux and Mac). DNX Core contains almost everything but is missing a few Windows namespaces like System.Drawing for example. [Update: DNX is replaced by dotnet].
- We can use both the frameworks “
dotnet 4.6” and “
dotnet core” in our application. They are defined in framework section of project.json file. The advantage is that common compatible code can be shared, which works for both the frameworks. But there are some libraries which will not work with .NET core like reflection or drawing bit map. But we can separate code using #if directives. Like,
#if DNX451 //code targeted for .NET 4.5.1 #endif #if DNXCORE50 //Code targeted for core clr #endif
- There is also a command line tool named “DNVM – .NET version manager“. It allows to upgrade or install new dnx version.
- ASP.NET Core works on file system which allows faster development cycle. It detects the code changes (even outside visual studio), compiles into memory and loads the application.
- ASP.NET Core has inbuilt support for Dependency injection. ASP.NET Core includes a simple built-in container (represented by the
IServiceProviderinterface) that supports constructor injection by default, and ASP.NET makes certain services available through DI.
- ASP.NET Core is also cloud ready as it supports environment-based configuration. Read more about environment-based configuration in launchSetting.json file.
- ASP.NET Core uses completly new light-weight and modular HTTP request pipeline.
HTTPModulesare also gone. Now they are replaced with Middleware.
- The heart of ASP.NET application “System.web” DLL is no longer available.
- With ASP.NET Core, webforms are history. Though, you can use webforms using .NET 4.6 framework.
- JSON is preferred over XML for configuration settings. Read Various JSON files in ASP.NET Core.
- There is no
web.configis replaced with
Startup.cs. Startup.cs is entry point for application itself. Also read “Static Void Main in ASP.NET Core startup.cs“.
- The new Project.json file is heart of your project. It defines dependencies, runtime to use, and defines build and publish setup. It defines as project as DNX project.
wwwrootdirectory in project is for static content like css, Js, images. And it’s the
default root of your server. If a request comes in for a static file on disk, if the file is in this folder then it can go back to client. The name can be changed from project.json file. Read this post to find out how to rename it.
- All our compiled DLL are placed into project’s Bin folder. And now the bin folder is moved to “Artifact” folder (at the same location).
- Now you can directly add the reference of any assembly just via typing. Add assembly name with version in project.json file and Visual studio will add the reference for you. Read my post “What is Project.json in asp.net core“
- ASP.NET Core is designed to integrate seamlessly with a variety of client-side frameworks, including AngularJS, KnockoutJS and Bootstrap.
- Bundling and minification is done using grunt or gulp, unlike defining bundles in BundleConfig file.
- ASP.NET Core also comes with Unified Programming Model for MVC6 and Web API. In previous versions of ASP.NET MVC, MVC controllers were different from Web API controllers. An MVC controller used the System.Web.MVC.Controller base class and a Web API controller used the System.Web.Http.ApiController base class.
- .csproj becomes .xproj. The new project file doesn’t include manifest and list of all the files that are include in your project, as earlier with .csproj.
- By default, a class library project when compiled, becomes a nuget package instead of DLL.
- There is also a new code editor named “Visual studio code” to work on linux and mac. Read What is Visual Studio Code and is it different from Visual studio 2015?
[UPDATE: ASP.NET Core RC2 is out. And some of things are changed now. So I recommend you to read my other post Quick summary of what’s changed in ASP.NET Core RC2
That’s all I can think of. I know there are many points which can be included in this list. But I want to keep this short and simple. If you come across any, please mention in comments section or send it on twitter/facebook. Keep visiting for updates and share this in your network.