使用 WiX 将程序集放入 GAC 和安装路径中

发布于 2024-08-14 05:34:44 字数 141 浏览 1 评论 0原文

我刚刚开始学习如何使用 WiX,但遇到了障碍。我的软件包使用第三方库,该库要求 GAC 和软件包安装目录中都存在一些文件。

使用 WiX,我可以使文件显示在安装目录或 GAC 中,但不能同时显示在两者中。

有什么办法可以解决这个问题吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蓝天 2024-08-21 05:34:44

这里有一篇关于 安装程序集GAC 和本地文件系统。其中包含一些实际的 WiX 代码,可以满足您的需求。

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.

世界等同你 2024-08-21 05:34:44

我找到了该帖子 - 此后已移动,新 URL 位于:https://devblogs.microsoft.com/setup/installing-assemblies-for-runtime-and-design-time-use/

本质上,您创建 2 个组件,GAC 一个进入一个基本上被忽略的新文件夹,因为它将转到 GAC,另一个组件将转到您要复制到的位置 - 只是没有 Assembly=".net" 属性。

下面的示例来自代码,我已经使用这种技术在我的项目中运行了它。

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

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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文