It’s been quite a 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
IServiceProvider
interface) 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 completely new light-weight and modular HTTP request pipeline.
HTTPHandler
andHTTPModules
are 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, web forms are history. Though, you can use web forms 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.config
andglobal.asax
files now.web.config
is replaced withappsettings.json
andglobal.asax
is nowStartup.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.
wwwroot
directory 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.
- ASP.NET Core has also inbuilt support for client side package manager bower. It now also supports JavaScript task runners grunt/gulp, web project scaffolding tool Yeoman. Read “Why Yeoman for ASP.NET applications?“. They have also integrated inbuilt support of TypeScript. Read Latest TypeScript Interview Questions for beginners
- 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 included 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 the 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.
Excellent site and very informative
Hello,
Really liked your site especially the .Net articles.
I would request that can you share the website template you are using. Its really clean and very simple.
Kindly suggest.
Thanks and regards,
Hitesh
Thanks you Hitesh. This blog uses sparkling theme.
Here is the link,
https://colorlib.com/sparkling/
Nicely articulated summary. Thanks for the share.
How can we create 3 layer architecture in asp.net core.
simple and short !!!! ,keep continue !!!!
Awesome article!! Thank you.
This is superb explanation. Fantastic work. Thank you so much.
Thank You Siva. I am glad that you liked it.
good points very helpful
Thanks Venkat!!!
It is a nice summarized article to know about big changes in short time. Thanks Talking Dotnet
Thanks for stopping here and putting your comments. I am glad that it helped you.
Wow! Great article. Thank you very much for sharing your knowledge man. 🙂
Thanks Mitta for your comment and feedback.
By far the greatest summary I’ve read about asp.net core. Thanks!
Mawo,
Thanks for reading the post and stopping here to provide your feedback. It really feel great to give something back to community.
thanks this give some idea of what’s going on? … so? the Asp.net 4.6 is going to dead?
No. Asp.net 4.6 is not going anywhere. If you wish to develop your application only for windows platform then 4.6 is the option.
Great article! Breaks down the differences well and gives areas to go off and investigate into.
Sounds like a great step in the right direction, IMO. Let’s start the resurgence of ASP.NET!
Cheers!
Thanks Daniel.
That’s good stuff to step-in.
Thanks for stopping here and providing your feedback.
very good quick overview on asp.net 5 (.net core and .net framework), moreover hybrid development (Mac, Android, Windows) while using asp.net .netframework
Thanks Anjan