MVC 6 vNext Web Application Guide Basic Overview

Application structure

Hello Guys this guide in the new vNext world will give you very brief information about the new, and from my point of view very exciting features, of Microsoft's vNext web applications.

First I really want to tell you that I'm very excited about this new technology, this is really something that is worth the time for learning. It is so different from the ASP.NET and at the same time so close.

I know it is an early release but you can see the potential that it carries, so let's get down to the guide.

So this guide is focused on ASP.NET vNext web applications over Visual Studio CTP 14, so if you are using a different version, be aware that there may be some inconsistencies.

So let's have a look at the application structure changes in the vNext.

vnextwebapp

As you can see the structure is similar to the previous versions of ASP.NET with several changes that are making the vNext ASP so great.

First thing that I want to focus on is that there are no longer Web.config and Global.ASAX files, they are split into multiple .json files that are storing various parts of the configuration information, needed for the smooth application work. The files are as follows:

  • Global.json: This file is at the same level as the solution file and is used to reference projects, by default Global.json is recognizing that all sources are at the src subfolder.

  • Config.json: Is the file that contains all the application data values such as the connection string, or application specific variables set by the developer.

  • Project.json: In this files are stored with all project-related configuration information necessary for the project to work, such information as:

    • Dependencies (NUGET packs or other projects): This are all the NUGET packages or projects over which your vNext application is relating.
      The cool thing about these dependencies are that when you open the project in Visual Studio for the first time and you don't have some of them then your Visual Studio Is downloading them for you, so you can care less about missing DLLs and packages and focus much more over the development experience.

      dependencies

      In the picture above you can see that our current project is depending on several DLLs that are needed for the applications to work, as we can see we are using a MVC DLL (because our application is vNext MVC). We have dependency on the .Net framework.

    • Commands: In vNext rather than hosting your application in a web server, your process will bind to a port and serve itself directly. That's why the section Commands exists.

      With the commands section you are specifying the command that will be used to start the service and bind it to the port.

      command

      As we can see this command is starting the web server that is listening over port 5000.

    • Frameworks: Next thing that you can see in the file is this section that is describing the needed frameworks over which is working our project. This is giving you the flexibility to set only this frameworks that are needed from your project, so you can compress the size of your project even more.

  • Startup.cs: By default, the vNext hosting environment expects to find a startup file that is configuring the HTTP pipelines, initializing the functionality that will be used (MVC/rAzor, WEB API or other) , also here you can init. The routes and how they will be recognized. In other words startup.cs is the class that is initializing the application.

In Conclusion

The new direction that Microsoft has taken with vNext is really very exciting. Sure there are many changes from the classical .NET and I'm sure that we'll find many bugs in it however, this new framework is providing the developers with the power to change, the power to change and customize every bit of their code, every bit of their framework and also every bit of the way the application will be executed and published.

Have a nice Day
P.

Up Next
    Ebook Download
    View all
    Learn
    View all