Quick summary of what’s changed in ASP.NET Core

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.

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,

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.

There is no web.config and global.asax files now. web.config is replaced with appsettings.json and global.asax is now 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.

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“

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.

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.CodeProject

PS: If you found this content valuable and want to return the favour, then