WiX:自定义安装文件夹 [英] WiX: Custom installation folder

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

问题描述

我是 WiX 的新用户.在我尝试开发的安装程序中,我需要将文件安装到 C:\Users\Public\Documents 的一些现有子文件夹中.所以我的问题是:1. 如果目录 C:\Users\Public\Documents\myFolder 存在,如何检查 wix?2.如何写告诉Wix将文件安装到这个位置.

I am new user of WiX. In installer which I am trying to develop, I need install files to some existing subfolders of C:\Users\Public\Documents. So my questions are: 1. How to check in wix if directory C:\Users\Public\Documents\myFolder exists? 2. How to write tell Wix to install files to this location.

先谢谢你.

推荐答案

您可以使用 WIX_DIR_COMMON_DOCUMENTS (OSInfo 自定义操作) 将文件传送到公共文档文件夹中.在 TARGETDIR 内使用以下代码发送文件.

You can use WIX_DIR_COMMON_DOCUMENTS (OSInfo custom actions) to ship the files into Public Documents folder. Inside the TARGETDIR use the below code to ship the files.

<Directory Id="WIX_DIR_COMMON_DOCUMENTS">
    <Directory Id="SampleFolder" Name="myFolder">
        <Component Id="CMP_myFolder" Guid="{YOUR_GUID_HERE}">
          <File Id="File_Test" Source="Test.txt" KeyPath="yes" />
        </Component>
     </Directory>
</Directory>

您可以使用 DirectorySearch 元素来检查目录是否存在.但是您不能将 WIX_DIR_COMMON_DOCUMENTS 与 DirectorySearch 元素一起使用,因为 DirectorySearch 在 AppSearch 操作 和 OSInfo 自定义操作在 AppSearch 之后运行.因此,您需要编写一个自定义操作来读取公共文档文件夹.

You can use DirectorySearch element to check the Directory is exists or not. But you can’t use the WIX_DIR_COMMON_DOCUMENTS along with DirectorySearch element, since DirectorySearch is running in AppSearch action and OSInfo custom actions are run after AppSearch. So you need to write a Custom action to read the Public Documents folder.

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

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