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

本小妞迷上赌 提交于 2019-12-09 14:48:08

问题


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?


回答1:


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.




回答2:


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>


来源:https://stackoverflow.com/questions/1891278/using-wix-to-put-an-assembly-into-both-the-gac-and-install-path

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!