ASP.MVC 6 Features - Managing Dependencies

In MVC 6, Microsoft has completely revamped the logic for for adding and managing dependencies in the application. They have now introduced a file called Project.json for organizing dependencies. This new file is not only used for managing dependencies but also for other options such as compilation settings, managing runtime frameworks, adding postbuild/prebuild scripts etc.

As the name indicates the information is stored in JSON format as shown below

Intellisense is available inside the json file also which makes the task of adding new ones easier. It's not only limited to names but also for version numbers too. Here also note that the icon represents the type of the package that's going to added.

When you click save after adding the dependency in the json file, Visual Studio will automatically restore the package manager from available feed and will add it under the dependencies folder.

Whenever you adds a package using NuGet package Manager/Console, the entry gets added to the projects.json file

ASP.NET Core 1.0 support multiple framework, meaning you can deploy your application to different environments. By default it supports .NET 4.5.1 framework as well as .NET Core framework which is a subset of the main framework.

DNX4.5.1 is the code for the full framework or full CLR

DNX Core 5.6 is the code for .NET Core

Whenever you define multiple frameworks, compiler ensures that it runs on all the defined frameworks. One main advantage of supporting multiple frameworks is code resuability which means that with one single code base we target apps for Windows, Mac or Linux.


No Comments

Add a Comment