Click here to Skip to main content
15,889,216 members
Articles / Web Development / ASP.NET

ASP.NET 5 – Part I

Rate me:
Please Sign up or sign in to vote.
3.93/5 (9 votes)
8 May 2015CPOL3 min read 18.3K   10   4
ASP.NET 5 Features - Part 1

In this section, we’ll see the major changes in ASP.NET 5. The very first 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 the 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. First is the full blown runtime as 4.5.1 or greater than that or the second 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, let's go ahead and start the demo. I already have RC version of VS 2015 installed on my 2ndry machine. Let's go ahead and create a 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 the below output. Very traditional MVC APP.

4th

5th

6th

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

7th

8th

This also means whatever changes I make 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, let's 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, it will return the new controller’s output. So, this is called dynamic compilation.

14th

Thanks for joining me for the first edition of ASP.NET 5. We’ll delve further in coming topics. Till then, stay tuned and happy coding!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect Publicis Sapient
India India
Hey there, it's Rahul Sahay! I'm thrilled to be a platform specialist at Publicis Sapient, where I get to work on some exciting projects. I've been honing my skills in various aspects of the software development life cycle for more than 15 years, with a primary focus on web stack development. I've been fortunate to have contributed to numerous software development initiatives, ranging from client applications to web services and websites. Additionally, I enjoy crafting application architecture from scratch, and I've spent most of my time writing platform agnostic and cloud agnostic code. As a self-proclaimed code junkie, software development is more than just a job to me; it's a passion! And I consider myself lucky to have worked with an array of cutting-edge technologies, from .NetCore to SpringBoot 3, from Angular to React, and from Azure to AWS and many more cousin technologies...

- 🔭 I’m currently working @ below tech stacks
- Microservices,
- Distributed Systems,
- Spring Boot
- Spring Cloud
- System Design,
- Docker,
- Kubernetes,
- Message Queues,
- ELK Stack
- DotNetCore,
- Angular,
- Azure

- 💬 Ask me anything about my articles [My View](https://myview.rahulnivi.net/)
- 📫 How to reach me: [@rahulsahay19](https://twitter.com/rahulsahay19)
- 📫 Github: [@rahulsahay19](https://github.com/rahulsahay19)

Comments and Discussions

 
GeneralMy vote of 5 Pin
graham bell11-May-15 4:45
graham bell11-May-15 4:45 
QuestionAwesome Article Pin
graham bell11-May-15 4:43
graham bell11-May-15 4:43 
GeneralMy vote of 4 Pin
Santhakumar Munuswamy @ Chennai9-May-15 9:28
professionalSanthakumar Munuswamy @ Chennai9-May-15 9:28 
GeneralRe: My vote of 4 Pin
rahulsahay209-May-15 9:35
rahulsahay209-May-15 9:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.