mscoree.dll 在 Windows 7 上的位置和实例

Location and instances of mscoree.dll on Windows 7

几本书(Inside Windows Debugging [2012] by T. Soulami,Pro C# with .NET 3.0 by A. Troelsen)指定了 mscoree.dll 作为 system32 文件夹。但是,在我的 32 位 Windows 7 系统上,有 两个 个 mscoree.dll 文件实例,位于以下位置:

C:\Windows\winsxs\x86_netfx-mscoree_dll_31bf3856ad364e35_6.2.7600.16513_none_7daed23956119a9f
C:\Windows\winsxs\x86_netfx-mscoree_dll_31bf3856ad364e35_6.2.7601.17514_none_7f96335553371a30

此外,我的印象是在 .NET 可执行文件 bootstrap 进程中只使用了(应该)此垫片 DLL 的一个版本。

希望得到解释。

当然,这是 Windows 的 well-hidden 实现细节,从 Vista 开始。 c:\windows\system32 目录的内容不是文件,它们是引用 side-by-side 缓存中文件的 硬链接 。在 this blog post 中涵盖得很好,标题恰如其分 "Don't trust all your eyes tell you"。

您可以使用 fsutil.exe 实用程序列出链接。在我的 Windows 8.1 机器上:

C:\Windows\System32>fsutil hardlink list mscoree.dll
\Windows\WinSxS\amd64_netfx-mscoree_dll_31bf3856ad364e35_6.3.9600.16384_none_a61e5c302a20ae78\mscoree.dll
\Windows\System32\mscoree.dll

您的 side-by-side 缓存包含多个版本,因为您获得了 .NET 更新,可能是通过 Windows 更新提供的。它会保留旧文件,以便您可以卸载更新。