ASP.NET Core: File System, Background Compilation, and Editors

In this article I will explain how we can verify that ASP.NET Core support new Project System is based on File and does background compilation.

In this article, I will create an ASP.NET Core web application in which I will demonstrate how to verify that ASP.NET Core support new Project System is based on File and does background compilation. I am using Visual Studio Code Editor for this article; you can use Visual Studio 2015 or any other editor like Vim, Sublimer, Atom, etc.

Popular Editors for ASP.NET Core,

editors

If you are not aware about Visual Studio Code Editor and Yeoman you can read these articles:

  1. ASP.NET 5 With Open Source - Part 1
  2. ASP.NET 5 With Visual Studio Code: Part 2

Go to Run and type “cmd” to open command prompt.

Change the directory and go to the directory where you want to create your ASP.NET Core Application.

Type “yo aspnet”,

yo aspnet

Select Web Application, give the name of web application as "App_BGComplilation".

Web Application

I ran all four commands cd “App_BGCompilation”, “dnu restore”, “dnu build” & “dnx web”.

Now we will find that it hosts the application on http://localhost:5000. This is the default URL, if you wish, you can change it.

I entered URL http://localhost:5000/Home/index in the browser and it display the page.

Background Compilation

Now open Visual Studio Code Editor to edit the code. Type “code .” on command prompt,

Now add a method in HomeController.cs,

public string AboutMe()=> "My Name is Banketeshvar Narayan Sharma. I am C# Corner MVP.";

visual studio

Just save the changes and hit the URL http://localhost:5000/Home/AboutMe,

about me

So we can see that I have not compiled the application but I am getting the new action without compilation. Now we are sure that in ASP.NET Core compilation is done in background.

File System

Open the path where web application “App_BGComplilation” has been created go to “wwwroot” add a file “ReadMe.html”,

readme

Now hit the URL http://localhost:5000/Readme.html in browser and you can see that it is displaying the page. It means it is based on the file system. We do not need to add this file anywhere like inside .sln file or include the file in project.

project
In this article we have seen that ASP.NET Core use the power of Roslyn and DNX to create project based on file system and do the background compilation.

Read more articles on ASP.NET Core:

  1. Creating HTTP/2 Supported Website with ASP.NET Core & Hosting In Windows 10 (IIS 10.0.x)
  2. ASP.NET 5 with Open Source - Part 1
  3. ASP.NET 5 with Visual Studio Code: Part 2
  4. Creating ASP.NET 5 Web Application with Visual Studio Code
  5. Resolving ASP.NET 5 DNVM Upgrade Issue And Changing DNX Version