使用WiX自定义操作在安装文件夹中创建文件 [英] Create file in installation folder using WiX custom action

查看:203
本文介绍了使用WiX自定义操作在安装文件夹中创建文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试创建一个 wix 安装程序,安装后需要在程序文件夹中创建文件。为此,我创建了一个自定义操作,但是现在遇到以下问题:

I try to create a wix installer that has the need to create a file in the programme folder after Installation. For doing so, I have created a custom action, but I now have the following problem:

要写入文件,我需要从 session [ INSTALLDIR] ,仅在执行操作立即 时可用。

In order to write the file, I need to know the installation directory from session["INSTALLDIR"], which is only available if the action is executed "immediate".

但是,如果我在安装文件之后运行立即,则目标目录尚不存在。如果我运行 deferred,则它存在,但是我无法访问 session [ INSTALLDIR]

However, if i run "immediate" after "install files", the target directory does not yet exist. If I run "deferred", it exists, but i cannot access session["INSTALLDIR"].

如果我在 InstallFinalize之后运行 immediate,我可以获取变量并且目录存在,但是我没有被提升,因此不允许写该文件。

If I run "immediate" after "InstallFinalize", I can get the variable and the directory exists, but I am not elevated and hence not allowed to write the file.

什么将文件写入安装目录的正确组合是什么?

What is the correct combination for writing a file to the installation directory?

推荐答案

您需要使用CustomActionData来访问延迟的属性值CA。您需要类似

You need to use CustomActionData to access property values from a deferred CA. You need something like this

另​​一个答案

这篇关于使用WiX自定义操作在安装文件夹中创建文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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