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

ASP.NET 5 Part – 3

Rate me:
Please Sign up or sign in to vote.
4.00/5 (2 votes)
15 May 2015CPOL4 min read 16.4K   5   3
ASP.NET 5 Part – 3

Introduction

In today’s discussion, we’ll delve further into some more interesting features on ASP.NET 5. So, let's 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. The first one is the usual one which has the full blown version of CLR which we have been using since its 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.

37th

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.

38th

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 the previous section. It should print my name there.

39th

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

40th

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 are loading. Basically modules are nothing but have one to one mapping with assemblies. But, you can also have multiple modules per assembly. Now, this module window is showing me what all modules are loaded in the application.

41th

43rd

Now, one point to note here is 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.

44th

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

45th

This is complete Core CLR. Can you imagine? Now, what I can do is I can simply take this file and copy to a 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:

46th

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

47th

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

48th

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 the below location; you will find packages folder.

49th

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

50th

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 folders are referred to 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 that we have been using so far.

51th

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

52nd

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.

53rd

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:

54th

55th

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.

56th

Let’s use the same in Greet controller.

58th

59th

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.

Thanks,
Rahul Sahay

83 total views, 79 views today

 

Image 22

This article was originally posted at http://myview.rahulnivi.net?p=1774

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

 
QuestionGetAssemblies() Pin
Member 142680321-Mar-16 8:17
Member 142680321-Mar-16 8:17 
Questionthanks Pin
digish77718-May-15 16:57
digish77718-May-15 16:57 
GeneralMy vote of 4 Pin
Santhakumar Munuswamy @ Chennai16-May-15 19:34
professionalSanthakumar Munuswamy @ Chennai16-May-15 19:34 

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.