使用Wix安装后删除目录和文件 [英] Remove directory and files after installation using Wix

查看:178
本文介绍了使用Wix安装后删除目录和文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在安装过程中,我需要在InstallExecuteSequence标记asl After ="InstallFinalize"中配置的自定义操作"中添加一些其他文件.

During installation i need some extra files in Custom Actions that are configured in the InstallExecuteSequence tag asl After="InstallFinalize".

使用完文件后,我希望删除文件(和目录).

After the usage of the files, i want the files (and the directory) to be removed.

我该怎么做?

我的InstallExecuteSequence看起来像这样:

My InstallExecuteSequence lookst like this:

  <InstallExecuteSequence>
     <Custom Action="UNINSTALLSERVICE"
             After="InstallInitialize">REMOVE="ALL"</Custom>
     <Custom Action="CLEANUP"
             Before="RemoveFiles">REMOVE="ALL"</Custom>
     <Custom Action="INSTALLSERVICE"
             After="InstallFinalize" />
  </InstallExecuteSequence>

如果我使用以下方法创建自定义操作

If i create a custom action with

ExeCommand="cmd /C RD "somedir" /s /q"

并将其添加到这样的序列中:

and add it to the sequence like this:

 <Custom Action="CLEANTEMP" After="InstallFinalize" />

我收到一个构建错误:

Error   596 ICE77: CLEANCONFIG is a in-script custom action.  
It must be sequenced in between the InstallInitialize action 
and the InstallFinalize action in the InstallExecuteSequence table

推荐答案

更新:不知道为什么现在刚刚投票否决了.以下摘要是合理的建议. 也许是缺少样本?我将添加几个链接.还: 在某些情况下,需要使用自定义操作来调整服务 安装,但在设计服务时几乎不需要 正确-WiX还具有可帮助您进行常见调整的结构:

UPDATE: Not sure why this was down-voted just now. The summary below is sound advice. Perhaps it is the lack of a sample? I'll add a couple of links. Also: there can be cases where a custom action is needed to tweak service installations, but that is rarely necessary if you design the service properly - WiX also has constructs to help you for common tweaks:

  • Phil Wilson's samples from his book (many further samples for other topics one level up): https://github.com/Apress/def-guide-to-win-installer/tree/master/Chapter10.
  • Phil Wilson again with his Installing Services with Visual Studio sample.
  • Chris Painter and his IsWiX tutorials: https://github.com/iswix-llc/iswix-tutorials.


通常不需要使用自定义操作来安装和配置服务.内置的MSI功能由于其全面的回滚支持和广泛的功能集而非常优越.使用自定义操作会使事情复杂化,增加不必要的风险,并且在回滚期间几乎总是会失败,从而使系统处于无效状态.


There is generally no need to use custom actions to install and configure services. The built-in MSI features for this are vastly superior due to its full rollback support and extensive feature set. Using custom actions greatly complicates things, adds unnecessary risk and will almost always fail during rollback leaving the system in an invalid state.

MSI表有一个学习曲线-有很多选择,但以我的经验来看,只有少数几个设置才有意义.通常在安装过程中停止并重新启动,在卸载时停止并删除以及这些版本的变体.过去,我添加了自定义操作,只是在服务正常关闭时等待,但这只是一个等待自定义操作,不会更改系统.我可能不知道这种情况下可能会有新的Wix功能.

There is a learning curve with the MSI tables - there are a lot of options, but in my experience only a few bundles of settings make sense together. Generally stopping and restarting during install and stopping and deleting on uninstall and variations on those. In the past I have added custom actions just to wait whilst the service shuts down properly, but that is just a wait custom action and doesn't change the system. There may be new Wix features for this kind of scenario that I am unaware of.

MSI表 ServiceInstall ServiceControl 用于安装服务.在Wix中,您处理等效的XML元素: Wix ServiceInstall Wix ServiceControl 和更新的

The MSI tables ServiceInstall and ServiceControl are used to install services. In Wix you deal with the equivalent XML elements: Wix ServiceInstall and Wix ServiceControl and the newer Wix ServiceConfig and Wix ServiceConfigFailureActions.

这篇关于使用Wix安装后删除目录和文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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