使用 WiX 将文件夹安装到 ALLUSERS(不是快捷方式!) [英] Install a folder to ALLUSERS (not a shortcut!) using WiX

查看:35
本文介绍了使用 WiX 将文件夹安装到 ALLUSERS(不是快捷方式!)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 MSI 文件,它正在安装一个文件夹,里面有一堆文件.我有一个放置文件的位置:

I have an MSI file that is installing a folder with a bunch of files inside it. I have a location that I am putting the files in:

Windows XP:C:\Documents and Settings\All Users\Documents\MyFolder

Windows XP: C:\Documents and Settings\All Users\Documents\MyFolder

Windows 7:C:\Users\Public\Documents\MyFolder

Windows 7: C:\Users\Public\Documents\MyFolder

问题是我不想对这些路径进行硬编码,但无论我在哪里看,我都找不到如何做到这一点,因为我到处都在谈论为所有用户制作快捷方式,那就是不是我想要做的.如何将文件夹安装到所有用户"位置?

The issue is that I do not want to hardcode these paths, but no matter where I look I cannot find out how to do this, because everywhere I look they are talking about making shortcuts for all users and that is not what I am trying to do. How can one install a folder to an "All Users" location?

像这样:

<PropertyRef Id="WIX_DIR_COMMON_DOCUMENTS" />

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="WIX_DIR_COMMON_DOCUMENTS">
    <Directory Id="MyFolder" Name="MyFolder">

推荐答案

Windows Installer 没有 property 用于该文件夹,但 WiX 提供的自定义操作可以.

Windows Installer does not have a property for that folder, but a WiX-provided custom action does.

根据关于 OSInfo 自定义操作的文档:

  1. 参考链接器的 WixUtilExtension 扩展.
  2. 通过引用定义属性:

  1. Reference the WixUtilExtension extension for the linker.
  2. Define the property via a reference:

<PropertyRef Id="WIX_DIR_COMMON_DOCUMENTS" />

然后,在 TARGETDIR 目录下的某处定义目录.例如:

Then, define the directory somewhere under the TARGETDIR directory. For example:

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="WIX_DIR_COMMON_DOCUMENTS">`
        <Directory Id="MyFolder" Name="MyFolder" />`
      </Directory>`
    </Directory>`

这篇关于使用 WiX 将文件夹安装到 ALLUSERS(不是快捷方式!)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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