dskiles
dskiles

Reputation: 851

Using WiX to put an assembly into both the GAC and Install Path

I'm just starting to learn how to use WiX and I'm running into a snag. My package uses a third party library that requires some file to exist both in the GAC and the package installation directory.

Using WiX, I can make files show up in the installation directory, or in the GAC, but not both.

Is there any way to work around this?

Upvotes: 13

Views: 16320

Answers (2)

CAbbott
CAbbott

Reputation: 8098

There's a post here about installing an assembly to both the GAC and local file system. This has some actual WiX code in it that does what you're looking for.

Upvotes: 13

Charlotte Skardon
Charlotte Skardon

Reputation: 6270

I found the post - which has since moved, the new URL is here: https://devblogs.microsoft.com/setup/installing-assemblies-for-runtime-and-design-time-use/

In essence, you create 2 components, the GAC one into a new folder which is basically ignored, as it will go to the GAC, and another component to the place you want to copy to - just without the Assembly=".net" property.

The below example is from the code, and I've got it working in my project using this technique.

<Directory Id="ProgramFilesFolder">
    <Directory Id="ProductDirectory" Name="$(var.ProductName)">
        <Directory Id="GAC" Name="GAC">
            <Component Id="RT_MyControl" Guid="22887611-B13E-41EE-897C-D78830E68AEB" DiskId="1">
                <File Id="F_RT_MyControl" Name="MyCtrl.dll" LongName="MyControl.dll" Source="$(var.SrcPath)MyControl.dll" KeyPath="yes" Assembly=".net"/>
            </Component>
        </Directory>
        <Component Id="DT_MyControl" Guid="FB935B7D-D2BD-4B83-A26C-A9376EBA0915" DiskId="1">
            <File Id="F_DT_MyControl" Name="MyCtrl.dll" LongName="MyControl.dll" Source="$(var.SrcPath)MyControl.dll" KeyPath="yes"/>
        </Component>
    </Directory>
</Directory>

Upvotes: 6

Related Questions