ASP.NET 5 Part – 3

Hi Friends,

In today’s discussion, we’ll delve further to some more interesting features on ASP.NET 5. So, lets begin the show. Now, Let’s talk about the different CLR Types available with this project. So, when i talk about different CLRs; There are actually 2 versions of CLRs. 1st one is the usual one which has the full blown version of CLR which we have been using since it’s inception. Another one is the minimized version or also known as cloud optimized version of CLR. Now, let’s go ahead and check project settings.


As you can see in the above screen shot; my default setting is against full blown CLR which is running on the X86 machine. Now, if you see the drop down shown below. you will notice that i also have the option for cloud optimized version.


Now, let’s change the environment to cloud version and then run the app and inspect the output of the greet controller which we created in previous section. It should print my name there.


Now, let’s go ahead and debug this controller. So, now when i refresh the page it will hit the breakpoint as shown below.


Here, when I go in the modules section as shown below in the screen shot. It will list the complete flow. So, here you can see from where all the binaries loading. Basically modules are nothing but have one to one mapping with assemblies.But, you can also have multiple module per assembly. Now, this module window is showing me what all modules are loaded in the application.



Now, one point to note here that all these modules are coming from one location that is from user’s location as highlighted above. Let’s jump to this location for a minute and inspect the same.


Now, when I go inside there; i can see that there is nuget package file or NUPKG file which is around 14 MB.


This is complete Core CLR. Can you imagine. Now, what i can do is i can simply take this file and copy to different system my .NET Core version is ready. This bin directory here is the extracted version of this nuget package as shown in the below screen shot.


Also, when you go to the runtime folder and go to full blown CLR folder as shown below.


You will notice that size of the NUPKG file is very less compared to Core CLR version. Confused?


In case of full blown CLR, all components get loaded from GAC (Global Assembly Cache) not from here. But, it doesn’t mean that there is no centralized repository for Core CLR. So, if you go to below location; you will find packages folder.


So, now this will be the centralized repository for your Core CLR.


So, whenever, we install any dependencies it will sit here in this packages folder. So, ASP.NET 5 completely embraces nuget package. We manage dependencies via nuget package. We can have CLR stored through nuget package. Hence, these packages folder are referred as Global Package Cache.

Now, project.json is not only used to have the nuget dependencies only. we can have different project dependencies also listed here within the same solution. For example, let’s go ahead and add class library project to the solution folder. Make sure you install Vnext version of class library which means this class library project can have all the flexibilities of dynamic compilation what we have been using so far.


Once you added the project. Your solution will look like shown below. So, even the new project gets added under the src folder.


You will also notice that this new class library project also added new project.json file which also lists the dependencies accordingly for running Class library project.


Now, if i have to use this project in my web project; then i just need to include this newly created project in the dependencies section of project.json file of web project as shown below.



Now, when you don’t provide the version name against the package or project it will pull the latest one. Let’s go ahead and create some method in the class library project to return some meaningful thing.


Let’s use the same in Greet controller.



With this i will wrap this session. In the next section we’ll delve further into new features of ASP.NET 5. Till then stay tuned and Happy Coding.

Rahul Sahay
Happy Coding