关于.NET运行多个版本







当主程序编译结果是.NET Framework4.5








 
 
 
 
 
 
 
 
 
 
 
 













The 
DevExpress.XtraEditor.dll
如果出厂时,是在.NET Framework2.0环境下编译出来的,能否在上述环境下运行?猜想的可能是如下:





1.      
主程序激活对应版本的CLR, 如上例子是激活.NET Framework4.0,



2.      
主程序在调用DevEpress.Data.dll, 照样将其装入Process space.



3.      
DevExpress.Data.dll调用其依赖项dll



DevExpress.Data.dll是在.NET Framework2.0环境下编译的, DevExpress.Data.dll具体调用时候,会检查dll-Meta中的依赖项,比如.



.assembly extern System



{



 .publickeytoken
= (B7 7A 5C 56 19 34 E0 89 ) 



 .ver 2:0:0:0



}



.assembly extern System.Configuration



{



 .publickeytoken
= (B0 3F 5F 7F 11 D5 0A 3A )   



.ver 2:0:0:0



}



依具体dll.NET
Framework版本,装载对应版本的dll到同一个process空间运行。



 



这样就允许不同.NET
Framework版本的dll“混合运行”在同一个.NET Framework Runtime中。









CLRVer.exe – to tell .NET Framework
versions installed on your machine.





The CLR loading process:



1.      
All managed module and assembly
must use the Windows portable executable(PE)file format and be either Exe or
dll.



2.      
CLR be implemented as a COM
server contained inside a dll.



3.      
After windows examined the ExE
file’s header to determine whether to create 32-process, a 64bit process, or
WoW64 process, windows loads the the corresponding version of MSCorEE.dll into
the process address space.



4.      
The process primary thread
calls the method defined in MSCorEE.dll, and initializes the CLR



5.      
Loads the EXE assembly, Calls
the exe’s Main method.



 



 



 



 



原文地址:https://www.cnblogs.com/Solar/p/2294173.html