开发者

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?


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.


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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜