威克斯 - 如何删除非空文件夹 [英] wix - how to delete non-empty folder

查看:190
本文介绍了威克斯 - 如何删除非空文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已阅读本网站上有这样的问题,所有的话题,但没有找到我需要

I have read all topics on this site with problem like this, but not find what i need.

我有一个程序的两个版本:新旧。
在旧版本我有文件夹F1。
在新版本中,我有没有这个文件夹F1。

I have two versions of one program: old and new. In old version i have folder f1. In new version i have no this folder f1.

在新PROGRAMM的安装程序检测到旧版本,它删除旧版本,而不是文件夹F1。

When installer of new programm detected old version, it delete this old version, but not folder f1.

如何从新版的安装程序删除F1?

How can i delete f1 from installer of new version?

      <Component Id ="deleteall"  Guid="AA11A32B-9E1E-458A-8C94-3EFEDA77E494" >
        <RemoveFolder Id='iDocDir' On='both' />
      </Component>

      <Directory Id="iDocDir" Name="iDocs">
      </Directory>



没有工作=(

not working =(

推荐答案

您应该看看 RemoveFolderEx 在UtilExtension 的元素。这不正是你想要的。鲍勃Arnson在博客关于前

You should check out the RemoveFolderEx element in the UtilExtension. It does exactly what you want. Bob Arnson has blogged about it before.

<Component Id="deeletall" Guid="PUT-GUID-HERE">
    <util:RemoveFolderEx Id="RemoveiDocDir" On="uninstall" Property="iDocDir" />
</Component>

它的工作原理是写入临时rowes到 RemoveFile 表。有限制,但是用这个,作为手册指出:

It works by writing temporary rowes to the RemoveFile table. There are restrictions to using this, however, as noted in the manual:

由于它可能会显着影响Windows安装程序的文件成本核算,
临时行必须在CostInitialize之前写入标准
采取行动。不幸的是,微星并没有在你的包创建为
目录层次结构的属性,直到后来,在CostFinalize
的行动。

Because it might dramatically affect Windows Installer's File Costing, the temporary rows must be written before the CostInitialize standard action. Unfortunately, MSI doesn't create properties for the Directory hierarchy in your package until later, in the CostFinalize action.

这是简单的解决方法为
卸载过程中删除一个文件夹的一个典型的用例是将目录路径写入注册表和卸载过程中加载
吧。

An easy workaround for a typical use case of removing a folder during uninstall is to write the directory path to the registry and to load it during uninstall.

如果您使用自定义操作设置属性,确保它们是
计划的WixRemoveFoldersEx自定义操作了。

If you use custom actions to set properties, ensure that they are scheduled before the WixRemoveFoldersEx custom action.

和也是在Bob的帖子:

And also in Bob's post:

作为添加目录和被删除的文件会影响微星的文件
成本核算,RemoveFolderEx有耗资前做的事情。
不幸的是,微星并没有设立目标目录
性能,直到成本核算完成后。

As adding directories and files to be deleted affects MSI’s file costing, RemoveFolderEx has to do its thing before costing. Unfortunately, MSI doesn’t set up properties for target directories until after costing is complete.

如果你已经保存您以前的安装路径(罗布解释如何做到这一点这里的注册表),你很好,因为AppSearch操作CostInitialize之前运行。

If you already save your previous installation path (Rob explains how to do this here) in the registry, you're fine, as the AppSearch action runs before CostInitialize.

这篇关于威克斯 - 如何删除非空文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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