将 COM 组件安装到专用位置

若要强制 COM 客户端应用程序始终使用 COM 服务器的同一个副本,请编写应用程序的安装包,以指定 COM 服务器和客户端之间的独立组件关系。 这将 COM 服务器组件的专用副本安装到客户端应用程序专用的位置。 创作包时,请执行以下操作:

  • 将 COM 服务器 DLL 和 .exe 客户端置于单独的组件中。
  • IsolatedComponent 表中输入一条记录,表中 COM 客户端组件位于“Component_Shared”列,客户端应用程序位于“Component_Application”列。 在序列表中包括 IsolateComponents 操作
  • Component 表 Component_Shared 记录中设置 msidbComponentAttributesSharedDllRefCount 位。 安装程序要求对共享位置进行此全局引用计数,以在与其他安装技术共享的情况下保护共享文件和注册。