.net引用的程序集名称如何在运行时由clr解析? [英] How is the .net referenced assemblies names resolved by the clr at runtime?

查看:122
本文介绍了.net引用的程序集名称如何在运行时由clr解析?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我的.net exe运行时,它将在rumtime加载正确的.net程序集.我知道会发生一个探测过程.

when my .net exe runs, it loads the correct .net assemblies at rumtime. i understand that there is a probing process that happens.

我的问题是,如果我在ildasm中打开.net exe/dll,则仅对mscorlib.dll的.extern引用,对其他人则不然.

my question is that if i open up the .net exe/dll in ildasm, i only the .extern reference to the mscorlib.dll, not others.

那么clr如何获取进行.net引用的程序集探测所需的信息?

so how does clr gets the information required for doing the probing of the .net referenced assemlies?

我有一个示例项目和图像.

i have an example project and the images here.

因此,在这种情况下,我在任何地方都看不到.net程序集引用,例如System,System.Xml.Linq,Questions ..等,但是显然它们是由clr加载的,我确实在融合日志查看器中看到了它们.

so in this case, i dont see the .net assembly references anywhere like System, System.Xml.Linq, Questions etc.., but obviously they are loaded by the clr and i do see them in my fusion logviewer

.net程序集所需的数据在哪里?

where is the data required for .net assemblies located?

我注意到某些外部.net dll和其他外部.net dll如何将extern程序集放入清单时出现一些不一致的行为.

i've noticed some inconsistent behaviour behaviour how the extern assemblies are put the manifest for some core .net dlls and other external .net dlls.

谢谢

推荐答案

我明白了.其实我有点困惑. ILdasm显示的内容正确.所有静态绑定的dll都放在dll的清单中.

i got it. Actually i got confused a bit. what ILdasm shows is correct. All statically binded dlls are put in the manifest of the dll.

为什么我们看不到系统引用是因为mscorlib有一个系统"名称空间; GAC中的Sysem.dll具有该名称空间中的其余类. 因此,系统名称空间分为两个dll.最常见和最基础的都在mscorelibrary.dll中,其余的在system.dll中

Why we were not seeing system references is because mscorlib has a piece of ‘System’ namespace; Sysem.dll in GAC has the rest of the classes in that namespace. So System namespace is split in two dlls. Most commonly and basis ones are in mscorelibrary.dll and the rest in system.dll

实际上,Visual Studio有点误导性,始终将System.dll显示为参考,但并非总是如此

Actually Visual studio is little bit misleading to show System.dll always as a reference, which is not true always

使用时

     var bvv = new System.Uri("http://www.google.com"); ------ System.Uri class is in System.dll

     Console.WriteLine(bvv.AbsolutePath);--------------------- System.Console class is in mscorlib.dll

我可以清楚地看到对System.dll的引用

i could clearly see the reference to System.dll

这篇关于.net引用的程序集名称如何在运行时由clr解析?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆