Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install a folder to ALLUSERS (not a shortcut!) using WiX

Tags:

wix

wix3.7

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">
like image 939
Jimmy Avatar asked Jul 01 '13 15:07

Jimmy


1 Answers

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>`
like image 150
Tom Blodget Avatar answered Oct 14 '22 15:10

Tom Blodget