windows - Winsxs文件夹(Windows运行时程序集目录)中的文件夹名称的含义是什么

标签 windows windows-runtime winsxs

背景:

  • Windows 共享运行时库位于 C:\windows\Winsxs 文件夹
  • 在 Winsxs 内,有两个重要的子文件夹,分别为 policiesManifests
  • 除此之外,还有大量运行时程序集位于彼此的子文件夹中。
  • Winsxspolicies 内的所有子文件夹具有相同的命名格式。

例如文件夹名称:

  • 运行时间:x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_6f74963e
  • 政策:x86_policy.9.0.Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_x-ww_b7353f75

据我所知,名称的第一部分 (x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.1) 描述“processorArchitecture”(x86) 、“Name”(Microsoft.VC90.CRT)、程序集或策略的“publicKeyToken”(1fc8b3b9a1e18e3b) 和“版本”(9.0.30729.1)。

问题: 程序集 (x-ww_6f74963e) 或策略 (x-ww_b7353f75) 文件夹名称的最后一部分描述了什么?


好的,这是原始问题(但故事很长)。我在 Windows XP 计算机上部署了 C++ MFC 应用程序,该计算机先前安装了一些 C++ 重新分发包和一些运行时程序集的安全补丁。因此,这些预安装的 C++ 重新分发包会自动在 Winsxs/policies 中部署一些运行时策略。这些策略强制使用新的运行时程序集,而不是我的应用程序使用和部署的程序集。但有时,由于某些其他应用程序删除或程序集可能损坏,这些较新的 DLL 不存在。因此,我正在寻找一种方法来部署专门用于我的应用程序的运行时程序集(这意味着我的应用程序必须使用它部署的一次程序集并忽略策略)。所以我认为子目录名称的最后一部分与应用程序的身份相关联。我需要找到它。

最佳答案

如果您不能信任全局缓存(在 WinXP 上,很容易损坏它),您可能必须安装程序集的私有(private)副本并在应用程序配置中覆盖它们。

这是我用来覆盖一些程序集以进行调试的技巧:

在您的 exe 文件夹中,删除名为 yourexename.exe.config 的文件,其中包含将实际程序集版本重定向到全局缓存中永远不存在的内容的策略信息。例如:

<configuration>
    <windows>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity type="win32" name="someassemblyname" processorArchitecture="x86" publicKeyToken="sometoken"/>
                <bindingRedirect oldVersion="1.0.0.0-1.0.999.998" newVersion="1.0.999.999"/>
            </dependentAssembly>
        </assemblyBinding>
    </windows>
</configuration>

获取您要使用的程序集的内容,将其放入同一文件夹中并编辑 list 以获取您上面使用的版本。例如

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <noInheritable></noInheritable>
    <assemblyIdentity type="win32" name="someassemblyname" version="1.0.999.999" processorArchitecture="x86" publicKeyToken="sometoken"></assemblyIdentity>
    <file name="somedll.dll"/>
</assembly> 

最后您将在安装文件夹中获得以下文件:

yourexename.exe
yourexename.exe.config
somedll.dll
someassemblyname.manifest

您的可执行文件将获取该 dll 的私有(private)副本。

更多信息请点击:Application Configuration Files

编辑:如果您遇到“应用程序无法正确初始化”或“并排配置不正确”等问题(一旦您开始使用 sxs,您就会遇到这些问题),请使用 <强>sxstrace 诊断工具(但在 Windows XP 上不可用)。这将准确地告诉您哪个程序集导致了问题。

关于windows - Winsxs文件夹(Windows运行时程序集目录)中的文件夹名称的含义是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15961971/

相关文章:

c# - 为运行时应用程序创建 SIlverlight 包装器类

c# - 在 Windows Phone 8.1 中使用滚动查看器缩放时出现平移问题

c++ - SxS list 中的程序集身份名称

c++ - 我可以修改并排程序集搜索顺序吗?

windows - 如何使用 Windows 批处理增加文件夹名称?

c++ - 无法安装 Visual Studio C++ 包含文件 'excpt.h'

c++ - 预分配 std::string 以传递到 WinAPI

c++ - 替换 sync() 命令

c# - 相当于 WinRT Metro 中的 'KeyPreview' 属性

windows - Windows 7 和 Windows Server 2008 R2 中的不同 WinSxS 行为