Problem with installing assemblies to the GAC

2

I'm trying to deploy a couple of third party assemblies in the GAC with WiX. Some of these assemblies are mixed assemblies. The common way of doing this seems to be setting the assembly-attribute of the corresponding file to "net". However, doing it that way yields in an error during the installation:

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:...

The instructions I got from the vendor for installing the assembly to the gac is:

  1. Place all the dlls (d1, d2, d3,..., dn) in the same directory.
  2. Run gacutil on a subset of these dlls.

If I take a "raw" look in the gac, one of the folders contents looks like this:

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 has found out that d2.dll an d3.dll need to be placed in the same directory as d1.dll and has automaticaly done so.

How can I do this with wix? The only way I see right now is calling gacutil as a custom action, but this does not seem like a good solution.

Thank you Stefan

wix
asked on Stack Overflow Sep 26, 2011 by Stefan Lotz

1 Answer

4

In case anyone else is struggling with this:

To install a multifile assembly that is made up of one managed assembly and one or more native or mixed dlls that are referenced by the managed assembly, create the following structure in your 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>

Both unmanaged assemblies will go to the GAC-folder where the managed dll is installed to.

answered on Stack Overflow Sep 27, 2011 by Stefan Lotz

User contributions licensed under CC BY-SA 3.0