首页 新闻 会员 周边 捐助

dll 引用关系的问题

0
[已关闭问题]
<p style="margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto;">追踪一个dll引用了哪些其他的dll,以及这个dll被哪些dll引用了</p> <p style="margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto;">例:MyForm.dll 引用了</p> <div id="_mcePaste" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #ffffff; font-size: 12px; font-family: verdana, Arial, Helvetica; line-height: 18px; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-position: initial initial; background-repeat: initial initial; margin: 0px;">using System;</div> <div id="_mcePaste" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #ffffff; font-size: 12px; font-family: verdana, Arial, Helvetica; line-height: 18px; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-position: initial initial; background-repeat: initial initial; margin: 0px;">using System.Collections.Generic;</div> <div id="_mcePaste" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #ffffff; font-size: 12px; font-family: verdana, Arial, Helvetica; line-height: 18px; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-position: initial initial; background-repeat: initial initial; margin: 0px;">using System.Linq;</div> <div id="_mcePaste" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #ffffff; font-size: 12px; font-family: verdana, Arial, Helvetica; line-height: 18px; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-position: initial initial; background-repeat: initial initial; margin: 0px;">using System.Text;</div> <div id="_mcePaste" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #ffffff; font-size: 12px; font-family: verdana, Arial, Helvetica; line-height: 18px; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-position: initial initial; background-repeat: initial initial; margin: 0px;">using Digiwin.Common.UI;</div> <div id="_mcePaste" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #ffffff; font-size: 12px; font-family: verdana, Arial, Helvetica; line-height: 18px; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-position: initial initial; background-repeat: initial initial; margin: 0px;">using Digiwin.Common.Torridity;</div> <div id="_mcePaste" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #ffffff; font-size: 12px; font-family: verdana, Arial, Helvetica; line-height: 18px; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-position: initial initial; background-repeat: initial initial; margin: 0px;">using System.Windows.Forms;</div> <p style="margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto;">&nbsp;System.dll;System.Linq.dll;System.Text.dll;System.Windows.Forms.dll</p> <p style="margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto;">那在【引用的dll】中把System.dll;System.Linq.dll;System.Text.dll;System.Windows.Forms.dll这些dll列出来</p> <p style="margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto;">而&nbsp;MyForm.dll又被 MyDevelopForm.dll ;MyProphetionnalForm.dll引用了 ,那就在【被引用的dll】中列出MyDevelopForm.dll ;MyProphetionnalForm.dll</p> <p style="margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto;">&nbsp;</p> <p style="margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto;">请各位指点,最好有C#的实现代码,谢谢</p>
Yurnero的主页 Yurnero | 初学一级 | 园豆:125
提问于:2010-04-27 17:19
< >
分享
其他回答(2)
0

使用Reflector看看吧

上不了岸的鱼 | 园豆:4613 (老鸟四级) | 2010-04-27 19:31
0

使用Reflector看不出来你想要的效果,你既然可以查看某个DLL下引用了哪些DLL,那你可以遍历某个特定目录下的DLL是否包含引用你想要查看被引用的DLL。

Astar | 园豆:40805 (高人七级) | 2010-04-27 19:46
0

在 .NET 中,万物皆对象,Assembly 也是对象。它的类型为 System.Reflection.Assembly

其中,方法 GetReferencedAssemblies() 返回被本程序集引用的程序集。

       Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
       // Display the set of assemblies our assemblies reference.

        Display(indent, "Referenced assemblies:");
        foreach (AssemblyName an in a.GetReferencedAssemblies() )
        {
             Display(indent + 1, "Name={0}, Version={1}, Culture={2}, PublicKey token={3}", an.Name, an.Version, an.CultureInfo.Name, (BitConverter.ToString (an.GetPublicKeyToken())));
        }

至于程序集被哪个程序集引用了,不能直接查出来,你可以参考上边的方法,遍历一下目录下所有的程序集,自己统计出来。

 

 

冠军 | 园豆:1086 (小虾三级) | 2010-05-07 21:32
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册