Install a folder to ALLUSERS (not a shortcut!) usi

2019-04-10 11:00发布

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 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?

Something like this:

<PropertyRef Id="WIX_DIR_COMMON_DOCUMENTS" />

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

标签: wix wix3.7
1条回答
走好不送
2楼-- · 2019-04-10 11:39

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

Per the documentation on the OSInfo custom actions:

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

    <PropertyRef Id="WIX_DIR_COMMON_DOCUMENTS" />
    

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>`
查看更多
登录 后发表回答