.Net Core is a platform independent, modular and open source version of .Net framework. It is a complete re-write of .NetFramework with new CLR, Base Class Libraries for developing cross platform and cloud optimized applications. It is a modular framework, meaning developers can include only required package to build their applications. All the packages are delivered via Nuget package manager.
In other words, .Net Core framework packages can be included in your application privately or the framework can be installed on the machine (similar to full .NetFramework). Current version of .Net Core as of this writing is .Net Core 2.0 and the first official version is .Net Core 1.0. It is also delivered as complete installer package if required.
Repository: https://github.com/dotnet/core
.NetFramework vs .Net Core
-
Applications developed on .NetFramework can run only on Windows OS while .Net Core applications can be run on multiple Operating Systems like Mac and multiple flavors of Linux. Though, we have Mono framework for running .Net application in Linux but it is not a complete and stable framework to run .Net application in Linux environments.
-
Applications developed using .Net Core runs faster since .Net Core is a modular framework.
-
Like Full .NetFramework, .Net Core is also fully supported by Microsoft.
-
Unlike full .NetFramework, .Net Core is granularly packaged and they are available as Nuget packages.
.Net Core Supported Features
-
.Net Core currently supports Asp.Net Core web applications using MVC framework (called Asp.Net Core MVC). No WebForms Development.
-
Currently supports only C#. Full VB support is planned in a future update.
-
Supports development of command-line application.
-
No Desktop application development, Workflow and WCF service development. WCF client library for consuming SCF service is supported
-
Supports REST API development using Web API.
-
Supports SignalR applications development
-
Includes Entity Framework Core for ORM support.
-
Supports LINQ, Generics and Async features.
Tools Support
-
Visual Studio on Windows can be used to develop .Net Core applications. .Net Core 1.0 is released along with Visual Studio 2015 Update 3. The latest version Visual Studio 2017 has full support for developing .Net Core 2.0 applications.
-
A new IDE called Visual Studio Code can be used to develop .Net Core applications in Mac and Linux OS.
-
Includes a command line tool called “dotnet” or dotnet CLI to perform all activities like build, run from command line interface similar to open source platforms.
Quick Start
Pre-Requisite
-
All required package can be downloaded from here.
-
Need Visual Studio 2015 Update 3 or Visual Studio 2017 for full support. You can also use the free developer version called Visual Studio Community from here.
-
Download and install latest version of .Net Core 1.1 or 2.0 framework from here.
Visual Studio Tools for .Net Core Development
Download Visual Studio 2015 Tools from here to get tooling support for .Net Core development using Visual Studio 2015 Update 3.
Creating New Project
-
Open Visual Studio 2015 (Update 3) or 2017.
-
Go to File > New > Project… Select “ASP.Net Core Web Application(.NET Core)” template and click OK.
-
This will bring another dialog to pick the pre-configured template to start working with Asp.Net Core application. Select “Web Application” and click Change Authentication and select “Individual User Accounts". Click OK.
This will create a project with default controller implementation with Authentication to start development. All the pre-configured Nuget packages will be restored and the final solution explorer will look like,
-
Press F5 and you will see the default page created by Visual Studio project template.
Note – By default, the application will use Kestrel webserver to host the application.
Using dotnet Command Line Interface Tool (dotnet CLI)
The .Net Core sdk is packed with number of commands to work with .Net core applications from command prompt. Some of them are build, clean, run, restore etc.
For example, to run a .Net core application from command prompt we can use dotnet run.
To do this, Open command prompt, go to the directory where project.json file is located. It should be located at src/[projectname] folder. Type dotnet run and press enter. Refer the below image.
This command will start and host the application using Kestrel webserver. By default Kestrel will listen the port 5000 for application request. Visiting http://localhost:5000 you will see the .net core application up and running similar to above.