继续补充点吧。接上一篇,我们实现了.net framework的精简的步骤。

有网友评论了,那个核心的 mscoree.dll

从.net framework 2.0开始,微软开始了新的CLR承载模型。程序域模型。

参考文档:

https://msdn.microsoft.com/en-us/library/9x0wh2z3(v=vs.90).aspx

Hosting the Common Language Runtime

.NET Framework 3.5
 
 

For applications that were written by using the .NET Framework, hosting the common language runtime is completely transparent. If you compile your managed code as an .exe assembly, the runtime is started automatically by mscoree.dll when the .exe is run. However, unmanaged applications can also benefit from hosting the common language runtime. The runtime provides a framework for extending applications such as Microsoft Internet Information Services and Microsoft SQL Server 2005.

Whether it is invoked automatically, as with managed .exe assemblies, or loaded by using the unmanaged hosting API, a .NET Framework application requires a piece of code called a runtime host. The runtime host loads the runtime into a process, creates application domains within the process, and loads and executes user code within those application domains.

exe 的执行入口,就是那个mscoree.dll 。

所以 一旦在注册表 +系统目录中注册了这个Dll 那么托管语言的程序就能被加载执行。

This documentation is archived and is not being maintained.

Runtime Hosts

.NET Framework 3.5
 

The common language runtime has been designed to support a variety of different types of applications, from Web server applications to applications with a traditional rich Windows user interface. Each type of application requires a runtime host to start it. The runtime host loads the runtime into a process, creates the application domains within the process, and loads user code into the application domains.

从这段文字就看出来,虚机程序的奥妙所在。所有的虚机程序,都由运行时承载。

Loading the Common Language Runtime into a Process

.NET Framework 3.5
 

Before any managed code can be executed, the host must load and initialize the common language runtime. All hosts start with an unmanaged stub because the runtime is not yet running in the process. The .NET Framework provides a set of unmanaged APIs called the hosting APIs that the host can use to start the runtime. For more information, see Hosting Interfaces.

To load the runtime into a process, a host calls the CorBindToRuntimeEx Function function. The prototype for CorBindToRuntimeEx Function is located in Mscoree.h in the Include directory of the Windows Software Development Kit (SDK). The host uses CorBindToRuntimeEx Function to control which version of the runtime to load and the behavior of basic functions such as garbage collection and assembly loading. A host can set the values listed in the following table.

上述文字来自MSDN :https://msdn.microsoft.com/en-us/library/01918c6x(v=vs.90).aspx

托段代码加载执行前,需要开辟一个指定的进程进行承载。如何去开启运行时承载进行?.net 提供了一系列的非托管接口API,由这些API去开启承载进程。然后展开一系列的动作。

好了,看到这里,也基本能看出个大概了。

有网友希望提供精简版的安装包,期望各位能自己动手去完成。

 

【.Net Framework 体积大?】不安装.net framework 也能运行!?原理补充-3的更多相关文章

  1. 【.Net Framework 体积大?】不安装.net framework 也能运行!?开篇叙述-1

    [声明:请尊重作者micro-chen的原创,抓文章,请添加来源和作者署名.作者保留追责权利.......] 写在前言 看着日渐没落的.net ,心里多少有了点悲凉.国内的越来越多的新兴公司 都是JA ...

  2. 【.Net Framework 体积大?】不安装.net framework 也能运行!?原理简介-2

    接上一篇 [.Net Framework 体积大?]不安装.net framework 也能运行!?开篇叙述-1 昨天写了一个引子,还是有读者对这套“小把戏”感兴趣.那么不辜负大家的希望,争取博主不做 ...

  3. 安装.NET Framework组件时,电脑意外重启后再次安装失败

    因为软件运行环境需要安装.Net Framework,我安装的是2.0sp版本,可以安装过程中计算机意外关闭,重新打开后再次安装却出现安装失败的提示,具体内容是: 产品: Microsoft .NET ...

  4. C# winform程序免安装.net framework在XP/win7/win10环境运行!(转)

    C# winform程序免安装.net framework在XP/win7/win10环境运行!   前文: 首先感谢群里的大神宇内流云 提供的anyexec for windows版本. 经过本人搭 ...

  5. NSIS:判断并安装.NET Framework 4 的例子

    原文 NSIS:判断并安装.NET Framework 4 的例子 现在.NET开发的软件已经大行其道,但有些操作系统并不符合软件的运行要求,所以,我们需要在安装程序中进行.NET Framework ...

  6. Win10无法安装.net framework 3.5出错提示无法安装以下功能该怎么办?

    在Windows操作系统中,.NET Framewor对今天应用程序的成功提供了的安全解决方案,它能强化两个安全模型间的平衡.在提供对资源的访问,以便以完成有用的工作,对应用程序的安全性作细致的控制以 ...

  7. Windows 10 安装 Sql Server 2014 反复提示需要安装 .NET Framework 3.5 SP1 的解决方案

    一.首先安装.NET Framework 3.5: 离线安装方式: 1.装载相对应的系统安装盘,我是Windows 10 x64 企业版,所以装载Windows 10 x64 企业版安装镜像ISO,盘 ...

  8. Entity Framework 教程——安装Entity Framework环境

    安装Entity Framework环境 Entity Framework 5.0 API分布在两个地方,一个可在NuGet包管理器中找到,一个存在于.NET framework中..NET fram ...

  9. 安装.NET Framework进度条卡住不动的解决方案

    VS在安装之前需要安装.NET Framework,我安装的是4.0版本.但是安装进度条到一半左右时就卡住不动了.前前后后重试多次,还有几次重新开机,但都没用. 开始还以为是安装的系统有问题.后来在网 ...

随机推荐

  1. STM32内置参照电压的使用(转)

    源:STM32内置参照电压的使用 每个STM32芯片都有一个内部的参照电压,相当于一个标准电压测量点,在芯片内部连接到ADC1的通道17. 根据数据手册中的数据,这个参照电压的典型值是1.20V,最小 ...

  2. VS2010 中 error 2732: 链接规范与的早期规范冲突 的解决

    在实验室做项目的时候遇到了这个问题,终于整明白了. 一般来说这个错误出现在类似以下的语句中 extern "C" int yylex(void); extern "C&q ...

  3. js实现的文章输入检查与测速。

    在群里聊天,一个群友求助.说要实现 文章对比输入,出错了标红,正确的标绿. 同时还需要统计正确率. 我一开始以为很容易,结果搞了半天.最后折腾出来了. 这里的思路如下:利用js的数组.将文章和输入的内 ...

  4. 拓扑排序(Topological)

    #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<stdlib.h> #include<stack&g ...

  5. 优酷、YouTube、Twitter及JustinTV几个视频网站的架构

      优酷视频网站架构 一.网站基本数据概览据2010年统计,优酷网日均独立访问人数(uv)达到了8900万,日均访问量(pv)更是达到了17亿,优酷凭借这一数据成为google榜单中国内视频网站排名最 ...

  6. Objective-C中的面向对象编程

    1.过程式编程实例,画出Shape数组中的图形: // // main.m // hello-obj // // Created by zhouyang on 16/4/4. // Copyright ...

  7. C++中vector 容器的基本操作

    vector是一种简单高效的容器,具有自动内存管理功能.对于大小为n的vector容器,它的元素下标是0~n-1. vector有二个重要方法:     begin(): 返回首元素位置的迭代器.   ...

  8. ThinkPHP 分组,应用,跳转

    一.多应用配置技巧    在主入口文件index.php同级目录,新建一个 config.php 写入公共的配置项,然后在前后台各自的配置文件config.php中    $arr = include ...

  9. Java Swing paint repaint update 方法的关系

    Java Swing paint repaint update 方法的关系: 参考:http://blog.csdn.net/xiaoliangmeiny/article/details/691665 ...

  10. [linux]ngrep命令、常见用法

    1.ngrep命令 ngrep命令是grep命令的网络版,ngrep用于搜寻指定的数据包(抓包.过滤).能识别TCP.UDP和ICMP包,理解bpf的过滤机制. 1.1 安装 brew install ...