Wix 工具集 RemoveFolderEx 元素(实用程序扩展) [英] Wix Toolset RemoveFolderEx Element (Util Extension)

查看:37
本文介绍了Wix 工具集 RemoveFolderEx 元素(实用程序扩展)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 C# 应用程序有安装程序,当运行实用程序时没有创建其他文件/日志时,安装和卸载工作正常.

I have installer for my C# application , Install and uninstall works fine when there are no additional files/logs created while running utility .

但是当生成日志时,卸载不会删除目录和日志.我尝试使用 RemoveFolderEx Element (Util Extension) ,但我没有输出文件夹的组件 Id,因为它在运行时创建日志时保存在该文件夹中.

But when logs are generated , uninstall doesnot remove the directory and the logs . I tried using RemoveFolderEx Element (Util Extension) , but I do not have component Id for the output folder in which logs are saved as it is created on runtime.

如何删除输出文件夹,以便卸载干净,而不留下文件和文件夹

How can I remove output folder so that uninstall goes clean, without leaving files and folders

推荐答案

这有点仓促.如果您觉得有意义,我会回来查看.

您应该能够使用标准和内置的 RemoveFileMSI 中的功能 以删除日志文件 - 如果您知道相关文件的名称.然后,您可以将 CreateFolder 条目添加到您的安装程序中,这将创建有问题的日志目录,然后在您的 RemoveFile 条目中使用该目录属性:

You should be able to use the standard and built-in RemoveFile feature in MSI to remove log files - if you know the name of the files in question. Then you can add a CreateFolder entry to your installer which creates the logging directory in question and then use that directory property in your RemoveFile entry:

示例:/p>

<Component>
  <File Source="WiX.chm" />
  <Shortcut Id="WixChmShortcut" Directory="ShortcutFolder" Name="WiX Documentation" 
            Icon="WixSetupIcons.ico" IconIndex="0" Advertise="yes" />

  <RemoveFile Id="RemoveWixChw" Name="WiX.chw" On="uninstall" />
</Component>

创建文件夹 是您插入的 WiX 元素,以指示应在安装过程中创建一个空文件夹:

CreateFolder is a WiX element that you insert to indicate that an empty folder should be created as part of your installation:

   <Directory Id="Mydir" Name="My Directory">
      <Component Feature="MyFeature" >
        <CreateFolder />
        <File Id="NOTEPAD.EXE" Source="$(var.MyReleasePath)\Main Folder\NOTEPAD.EXE" />
      </Component>
   </Directory>

<小时>

一些进一步的想法:

  • 我不会登录安装文件夹 - 该文件夹应该是只读的.

  • I would not do logging in the installation folder - this folder is supposed to be read-only.

我会在其他地方登录,也许是在 UserProfile 的某个地方,甚至是临时文件夹(并让最终用户为此使用的任何机制对其进行清理).

I would log elsewhere, somewhere in the UserProfile perhaps, or even the temp folder (and let it be cleaned by whatever mechanism the end users have for that).

如果可能,我还会考虑记录到系统的事件日志而不是文件.

I would also consider logging to the system's event log instead of to a file, if possible.

这篇关于Wix 工具集 RemoveFolderEx 元素(实用程序扩展)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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