"Net Core" Dnx Overview

Source: Internet
Author: User
Tags hosting

1. What is. NET execution environment?

. NET execution Environment (DNX) is an SDK and runtime environment that contains all of the components you need to create and run. NET applications. It provides a host process, CLR host logic, and a management entry point. DNX is created for Web applications that perform cross-platform ASP. But it can also execute other types of. NET applications, such as console applications.

2. Why create DNX?

DNX provides an environment for development and execution on different platforms. You can use DNX to develop on one platform and then deploy it to another platform.

DNX simplifies the development of cross-platform applications, which are responsible for hosting the CLR, processing dependencies, and starting your application. You can define your application through a lightweight JSON configuration file, build your tool and publish it.

Package management has completely changed the development of applications now, DNX makes it easy to create and apply packages. DNX provides tools to install, create, and manage nuget packages. The DNX project simplifies the use of cross-compilation to generate different NuGet packages for different architectures. You can directly reference NuGet packages and also have dependencies. You can also create and secure development tools

DNX makes it easy to work with open source projects, and by DNX you can easily replace an already existing dependency with the source code. Let Dnx compile at run time, then you can debug the source code and modify it.

3. Engineering

A DNX project is a directory of files containing Project.json. The directory name of the folder is the name of the project. You can create a NuGet package with the DNX project. The Project.json file defines the metadata of your package, the dependencies of your tool, and which frameworks you need to use:

{

"Version": "1.0.0-*",

"description": "ClassLibrary1 Class Library",

"Authors": ["Daroth"],

"Tags": [""],

"Projecturl": "",

"Licenseurl": "",

"Frameworks": {

"net451": {},

"dotnet5.4": {

"Dependencies": {

"Microsoft.csharp": "4.0.1-beta-23516",

"System.Collections": "4.0.11-beta-23516",

"System.Linq": "4.0.1-beta-23516",

"System.Runtime": "4.0.21-beta-23516",

}

}

}

}

}

Under the "Frameworks" attribute you can declare which architecture you need to build your app. Dnx can cross-compile each schema to create a corresponding Lib directory.

You can use. NET Development Utility (DNU) to create, package, and publish DNX projects to generate binaries. Packaging can generate nuget packages and upload them to the package feed. Publishing is the packaging of all the relevant components into a separate file to publish the current app.

4. Reliance

Dependency in Dnx consists of a name and a version number. The version number should follow the semantic version (master number-minor version number-patch). A typical dependent reference installation of the NuGet package or another DNX project. References to projects are referenced in the current directory or with Global.json at the solution level:

{

"Projects": ["src", "test"],

"SDK": {

"Version": "1.0.0-rc1-final"

}

}

The Global.json file also defines the minimum DNX version to use to create the current project.

Dependencies can be passed, and you can assert your dependence only at the top level. DNX can download the entire dependency graph with the installed NuGet package. Project-dependent builds are built at run time, giving you the flexibility to deploy your DNX application with binary work or source files.

5. Packages and summaries

Reference to the package you first have to install your package, you can use DNU to go to install the download new package to the current or restore all dependencies. The following command is to download and install all the packages declared in Project.json:

DNU Restore

Packages are reset using the configured package files. You can configure a digest of the package with Nuget.config

6. Command

A command is a named. NET Running portal. You can define the commands in the Project.json file:

"Commands": {

"Web": "Microsoft.AspNet.Server.Kestrel",

"EF": "Entityframework.commands"

},

You can use DNX to execute your command as follows:

DNX Web

Commands can be created and published as NuGet packages, and you can use DNU to install global commands:

Dnu Commands Install MyCommand

7. Application Host

The DNX application host is the management portal that was first invoked by DNX, responsible for handling dependencies, explaining Project.json, providing additional services, and invoking the application's portal.

Alternatively, you can use the direct DNX to invoke your application portal. It is not uncommon to use DNX instead of DNX application hosts.

The DNX Application Host provides a system of application dependencies (such as IServiceProvider, Iapplicationenvironment, and Iloggerfactory). The application hosting service can be injected into the constructor in your main portal.

8. Compiling the module

The compile module is an extensible point that allows you to participate in the DNX compilation process. You can implement your own compilation module by implementing the Icompilemodule interface, and then put it into compiler/preprocess or compiler/postprocess.

9. DNX Version Management

You can install a different version of DNX to your machine. You can use. NET version Manager (DNVM) to manage different versions of DNX. DNVM lets you list different versions of DNX on your machine, and installs different versions to convert the currently active version.

"Net Core" Dnx Overview

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.