Fusion log viewer
大家在项目中是不是经常遇到DLL引用错误的情况,或者是DLL引用的版本,路径不对的情况。遇到这种情况一般处理起来比较困难,往往会觉得DLL版本正确了,引用路径正确了,为什么程序还是引用的老版本,程序是从什么地方引的老版本呢?为什么会引用到老版本呢?
今天我在项目中就遇到此种情况,多次google终于找到了一个利器,他可以详尽的分析程序所引用的DLL,包括DLL的路径,版本等。
Fusion Log viewer:
此利器可查看windows服务,Asp.net及winform程序的Accemblly引用情况。
用法如下:
1. 打开 Fusion Log Viewer. 在开始菜单中的vs菜单下找如下所示的菜单项。
也可以在vs的控制面板上输入 fuslogvm 回车。
2. 设置log path,
注意,此路径必须是程序运行帐号有读写权限。
如果是Asp.net程序,则需要将注册表项改成:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion
下的key: ForceLog的值改成1.
3. 运行程序,点击刷新,即可看到各App加载的Dll.
注:asp.net程序要重启应用程序池。
4. 选中某项DLL,点击 “View log”,即可查看此DLL加载的详情。
5. 详情示例如下:
*** Assembly Binder Log Entry (2013/8/29 @ 15:51:55) *** The operation was successful. Bind result: hr = 0x0. The operation completed successfully. Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Running under executable c:\windows\system32\inetsrv\w3wp.exe --- A detailed error log follows. === Pre-bind state information === LOG: User = IIS APPPOOL\HP LOG: DisplayName = HP.EMEA.Users, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null (Fully-specified) LOG: Appbase = file:///E:/WebForm/Benjamin/HP_EMEA/src/HP.EMEA.Web/ LOG: Initial PrivatePath = E:\WebForm\Benjamin\HP_EMEA\src\HP.EMEA.Web\bin;E:\WebForm\Benjamin\HP_EMEA\src\HP.EMEA.Web\App_Data\Dependencies LOG: Dynamic Base = C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\3f9f5b26 LOG: Cache Base = C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\3f9f5b26 LOG: AppName = 3dc751a6 Calling assembly : HP.EMEA.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. === LOG: This bind starts in default load context. LOG: Using application configuration file: E:\WebForm\Benjamin\HP_EMEA\src\HP.EMEA.Web\web.config LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/3f9f5b26/3dc751a6/HP.EMEA.Users.DLL. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/3f9f5b26/3dc751a6/HP.EMEA.Users/HP.EMEA.Users.DLL. LOG: Attempting download of new URL file:///E:/WebForm/Benjamin/HP_EMEA/src/HP.EMEA.Web/bin/HP.EMEA.Users.DLL. LOG: Attempting download of new URL file:///E:/WebForm/Benjamin/HP_EMEA/src/HP.EMEA.Web/bin/HP.EMEA.Users/HP.EMEA.Users.DLL. LOG: Attempting download of new URL file:///E:/WebForm/Benjamin/HP_EMEA/src/HP.EMEA.Web/App_Data/Dependencies/HP.EMEA.Users.DLL. LOG: Assembly download was successful. Attempting setup of file: E:\WebForm\Benjamin\HP_EMEA\src\HP.EMEA.Web\App_Data\Dependencies\HP.EMEA.Users.dll LOG: Entering download cache setup phase. LOG: Assembly Name is: HP.EMEA.Users, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null LOG: Binding succeeds. Returns assembly from C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\3f9f5b26\3dc751a6\assembly\dl3\edfaf494\093cd725_8ca4ce01\HP.EMEA.Users.dll. LOG: Assembly is loaded in default load context.