Asp.net5 使用dnvm的编译过程

Asp.net 5 compilation process using dnvm

谁能详细解释一下 Asp.net5 应用程序的编译和执行工作原理。

我对 .net 环境完全陌生

几个问题 当您使用 VS 2015 构建应用程序时(按 F5),我知道涉及的步骤是

现在当我 运行 应用程序使用 dnvm 时会发生什么,

  1. how is it compiled ?
  2. What does CoreClr do?
  3. how is CoreClr different from Clr
  4. What happens when we do dnu restore
  5. what happens when we do dnx . exe
  6. At what stage is the CIL generated , where is the CIL stored 
  7. At what stage the JIT is used?

谢谢

首先,DNVM is not used for compiling nor running your app. DNVM is an acronym for DotNet Version Manager and is used for managing different .NET version. You can for example have one app that uses .NET Core and another app that uses the full .NET Framework. The former is the cloud optimized, cross-platform version of the latter and which lets you deploy the runtime together with your app. Read more here关于不同点。

  1. 它是如何编译的?在 Windows 当前使用 "Roslyn" is used to compile your app. On Linux/Mac, Mono,但一旦在这些平台上受支持,将替换为 Roslyn。
  2. CoreCLR 有什么作用? CoreCLR 是 .NET Core 的运行时。
  3. CoreCLR 与 CLR 有何不同? CoreCLR 是 .NET Core 的运行时,CLR 是 .NET Framework 的运行时。
  4. 当我们 dnu restore 时会发生什么?您的应用程序的依赖项已下载并添加到包目录中。
  5. 当我们 dnx . exe 时会发生什么?它将在当前文件夹(由点表示)中查找 project.json 文件,并调用 project.json 文件中配置的 'exe' 命令。
  6. CIL是在什么阶段生成的,CIL存放在哪里? CIL是在编译的时候生成的。例如,当您执行 dnx . run 时,该应用程序将构建在内存中。另一方面,如果您执行 dnu build,它将为您的应用程序生成存储 CIL 的程序集(例如 dll:s)。
  7. 在什么阶段使用JIT? JIT 代表 Just-In-Time 编译,在应用程序执行时执行。它将 CIL 代码转换为本机平台特定代码。

您可以在 ASP.NET 5 documentation(进行中)中找到更多信息。