我正在尝试使用 WiX 在 GAC 中部署几个第三方程序集。其中一些组件是混合组件。执行此操作的常见方法似乎是将相应文件的程序集属性设置为“net”。但是,这样做会在安装过程中产生错误:
Error 1938. An error occurred during the installation of assembly ...One or more modules of the assembly could not be found. HRESULT: 0x80131042. assembly interface: IAssemblyCacheItem, function : Commit, component: ... MSI (s) (A8:B0) [12:32:39:085]:.... assembly .... One or more modules of the assembly could not be found. HRESULT: 0x80131042. assembly interface: IAssemblyCacheItem, function: Commit, component:...
我从供应商处获得的有关将程序集安装到 gac 的说明是:
- 将所有 dll(d1、d2、d3、...、dn)放在同一目录中。
- 对这些 dll 的子集运行 gacutil。
如果我在 gac 中进行“原始”查看,其中一个文件夹内容如下所示:
gac_32\d1\0.0.0.0_271E3736135E91A2\d1.dll gac_32\d1\0.0.0.0_271E3736135E91A2\d2.dll gac_32\d1\0.0.0.0_271E3736135E91A2\d3.dll
gacutil 发现 d2.dll 和 d3.dll 需要放置在与 d1.dll 相同的目录中,并且已自动执行此操作。
我怎样才能用wix做到这一点?我现在看到的唯一方法是将 gacutil 作为自定义操作调用,但这似乎不是一个好的解决方案。
谢谢 斯特凡
最佳答案
如果其他人正在为此苦苦挣扎:
要安装由一个托管程序集和托管程序集引用的一个或多个 native 或混合 dll 组成的多文件程序集,请在 WixSetup 中创建以下结构:
<Component Id="MyMultifileAssembly" Guid="abc">
<File Id="ManagedAssembly" KeyPath="yes" Source="$(var.ThirdParty)\Managed.dll" Assembly=".net"/>
<File Id="UnmanagedAssembly1" KeyPath="no" Source="$(var.ThirdParty)\Unmanaged1.dll" />
<File Id="UnmanagedAssembly2" KeyPath="no" Source="$(var.ThirdParty)\Unmanaged2.dll" />
</Component>
两个非托管程序集都将转到安装托管 dll 的 GAC 文件夹。
关于wix - 将程序集安装到 GAC 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7555500/