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

后端 未结 2 1490
-上瘾入骨i
-上瘾入骨i 2021-02-19 21:02

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

相关标签:
2条回答
  • 2021-02-19 21:13

    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.

    0 讨论(0)
  • 2021-02-19 21:26

    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 讨论(0)
提交回复
热议问题