GAC和sidebyside

GAC解决的问题是dotnet assembly如何共享assembly的问题,比如dotnet framework,肯定要部署到GAC中。注:dotnet assembly locate rule是先找GAC,再找当前app所在的目录树(CLR will firstly search in GAC for assembly loading and then get into app specific directory / path tree)。所以,对于公用的assembly,只有一条路:就是放在GAC中。

sidebyside assembly解决的是dotnet assembly 版本冲突的问题。两方面的工作借助OS作为媒介来实现:一方面,那些sidebyside assembly,比如donet framework assemblies,MFC,ATL,CRT dlls,需要一个manifest文件来描述它自己给OS; 另一方面,使用它们的app,需要一个manifest文件来告诉OS他要使用的是哪个版本的assembly。这个样子下来,OS就了了,就能在app跑起来的时候,知道app需要哪个版本的assembly并知道去哪里去找到啦。(DLL hell designates a group of problems that arise from the use of dynamic-link libraries in Microsoft Windows. Problems include version conflicts, missing DLLs, duplicate DLLs, and incorrect or missing registration. In SxS, Windows stores multiple versions of a DLL in the WinSXS subdirectory of the Windows directory, and loads them on demand. This reduces dependency problems for applications that include an SxS manifest.)

 

posted @ 2010-12-19 23:02  能巴  阅读(274)  评论(0编辑  收藏  举报