WiX:如何打包 exe 或 dll 仅在安装期间使用 [英] WiX: how to pack exe or dll to use only during installation

查看:38
本文介绍了WiX:如何打包 exe 或 dll 仅在安装期间使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在生成的 MSI(通过 WiX 项目创建)中包含一个 dll/exe,但我不想在安装过程中部署它们:我只想在某些 CustomAction 中使用它们我的目的是包含一个现有的 exe/dll,并在安装过程中从 wxs 代码(而不是从 CustomAction dll)调用它.
是否可以包含安装过程中未部署的文件?我的意思是,只将它们打包在生成的 MSI 中,并在它们在 %temp% 文件夹中解压时调用它们执行某些任务?
另外,如果有人可以展示一些如何通过 Product.wxs XML 代码单元包含 dll/exe 的示例代码,那就太好了.
谢谢.

I need to include a dll/exe in the resulting MSI (created through a WiX project), but I do not want to deploy them during installation: I only want to use them in some CustomAction my purpose is to include an existing exe/dll and call it during installation from wxs code (not from a CustomAction dll).
Is it possible to include files which are not deployed during installation? I mean, only pack them inside the resulting MSI, and call them for some task while they are unpacked inside %temp% folder?
Also, it would be nice if somebody could show some sample code of how to include dll/exe through the Product.wxs XML code unit.
Thanks.

推荐答案

是的,使用 二进制 元素.

<Binary Id='MyCustomActionBinary'
        SourceFile='$(var.CustomActionProject.TargetPath)' />

这将使它们可用于您的 CustomAction,您可以在其中使用 BinaryKey引用二进制的属性:

This will make them available to your CustomAction where you can use the BinaryKey attribute to reference the Binary:

<CustomAction Id='MyCustomAction'
              BinaryKey='MyCustomActionBinary'
              DllEntry='MyCustomFunction'
              Execute='deferred' />

这篇关于WiX:如何打包 exe 或 dll 仅在安装期间使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆