ASP.NET 5 – 1st Part

Hi Friends,

In this section, we’ll see that major changes on ASP.NET 5. The very 1st change is on the lines of Project system. Projects are now based on File System. So, all you need to do is add something to a project say new source code file is just to place the file in the right directory. So, you can edit the source code file, save the file and build just happens dynamically. Thanks to new Roslyn compiler which compiles the source code in memory which allows for faster build and faster refresh.

The project structure itself changed from previous versions. Also one point to note while building application, we’ll be having two different options of choosing runtime. 1st is the full blown runtime as 4.5.1 or greater than that or 2nd option we can have cloud optimized runtime also called core CLR. Here, all the pieces like JIT Compiler, Garbage Collector are packaged and designed keeping high throughput and low memory consumption in mind. And now the application can have this cloud optimized environment embedded with the application which makes it easier to have true side by side version and by embedded it means you can deploy the .net framework by copying the nuget package. So, the idea behind this cloud version of .NET runtime is; it should be platform independent which means it can also run on MAC and LINUX machine.

Another great fact about the new changes in ASP.NET 5 is the unification. So, now

MVC 6 = ASP.NET MVC + WEB API

In MVC 6, WEB API is merged with MVC. This means we will now have one set of controller class, one set of attributes, model binders etc. Also, it no longer relies on the namespace system.web which means it is easy to self host and run the core CLR. Now, with these changes in place it doesn’t mean that your existing projects won’t work in VS 2015; It will work as smooth as it was in earlier versions. Now, lets go ahead and start the demo. I already have RC version of VS 2015 installed on my 2ndry machine. Lets go ahead and create new project

1st

now, the below window is very much familiar to previous version. Here, i am interested in the new templates introduced. Hence, i am going to create a new project with ASP.NET 5 Website. This project will give me all the required components to run an app as shown below in the screen shot.

2nd

so, below shown window will be the new window for ASP.NET 5 project.

3rd

And when i run the same, it will produce me the below output. Very traditional MVC APP.

4th

5th

6th

One point to also note that now folder organization in the file system and solution explorer is same as you can see in the below screen shots.

7th

8th

This also means whatever changes i do in the file system under src folder it will take effect in VS. Let’s create myImages folder in the file system with one image there. As soon as i added the image in the file system, it gets automatically synced with Solution Explorer.

9th

10th

Now, lets create one controller say GreetController but from the notepad; this is just to prove the point that we don’t need to build the app to take the code changes effect.

13th

Now, after saving the same when i refresh the browser, then it will return me new controller’s output. so, this is called dynamic compilation.

14th

Thanks for joining me for the 1st Edition of ASP.NET 5. We’ll delve further in coming topics. Till then stay tuned and Happy Coding.

Thanks,
Rahul Sahay
Happy Coding

2,854 total views, 1 views today

5 thoughts on “ASP.NET 5 – 1st Part

    • I know that as its relied on 3rd part app. so, this is not problem with my blog. its with the app.once, they will upgrade same will take effect here as well.

Comments are closed.