4
votes

I'm trying to build a very simple installer that just installs the package as a "per-user" application. No dialogs, just always install into the local app data folder. And it's ignoring me. And always installing to C:\Program Files.

I've set the InstallScope to "perUser", but left the installation directory as "ProgramFilesFolder". The documentation seems to suggest that that SHOULD get redirected, but that isn't happening.

Setup file below...

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*"
         Name="MyApplication"
         Language="1033"
         Version="1.0.0"
         Manufacturer="MyCompany"
         UpgradeCode="19E4E10A-558C-4D4A-BD2A-D6B8060FB917">

    <Package
            InstallerVersion="500"
            Compressed="yes"
            InstallPrivileges="limited"
            InstallScope="perUser" />

    <MajorUpgrade
            DowngradeErrorMessage="A newer version of MyApplication is already installed." />

    <MediaTemplate
            EmbedCab="yes" />

    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
            <Directory Id="INSTALLDIR" Name="MyCompany MyApplication">
                <Directory Id="JreFolder" Name="jre"/>
                <Directory Id="LibFolder" Name="lib"/>
            </Directory>
        </Directory>
        <Directory Id="ProgramMenuFolder">
            <Directory Id="ApplicationProgramsFolder" Name="MyCompany MyApplication"/>
        </Directory>
    </Directory>

    <DirectoryRef Id="INSTALLDIR">
        <Component Id="CMP_MyApplication.exe">
            <File Id="FILE_MyApplication.exe" Source="MyApplication.exe" KeyPath="yes"/>
        </Component>
        <Component Id="CMP_MyApplication.ini">
            <File Id="FILE_MyApplication.l4j.ini" Source="MyApplication.l4j.ini" KeyPath="yes"/>
        </Component>
    </DirectoryRef>

    <DirectoryRef Id="ApplicationProgramsFolder">
        <Component Id="CMP_StartMenuShortcut" Guid="0B96A876-70FB-4E8E-8D27-B9B1E40C9B4D">
            <Shortcut Id="ApplicationStartMenuShortcut" Name="MyCompany MyApplication" Description="MyCompany MyApplication"
                      Target="[#FILE_MyApplication.exe]" WorkingDirectory="INSTALLDIR"/>

            <RemoveFolder Id="CleanUpShortCut" Directory="ApplicationProgramsFolder" On="uninstall"/>
            <RegistryValue Root="HKCU" Key="Software\MyCompany\MyApplication" Name="Installed" Type="integer" Value="1" KeyPath="yes" />
        </Component>
    </DirectoryRef>

    <Feature Id="MainApplication" Title="Main Application" Level="1" >
        <ComponentGroupRef Id="JreGroup"/>
        <ComponentGroupRef Id="LibGroup"/>
        <ComponentRef Id="CMP_MyApplication.exe"/>
        <ComponentRef Id="CMP_MyApplication.ini"/>
        <ComponentRef Id="CMP_StartMenuShortcut"/>
    </Feature>
  </Product>
</Wix>
1
Where was it mentioned that 'ProgramFilesFolder' should be redirected if installing per user?TeaHoney
MSDN documentation for installation context: msdn.microsoft.com/en-us/library/windows/desktop/…David
This is msdn documentation - this does not mean that WIX behaves in the same way. For example in WIX burn the ProgramFilesFolder resolves to CSIDL_PROGRAM_FILESX86 - this might be what happens to WIX MSIs as well ( wixtoolset.org/documentation/manual/v3/bundle/…)TeaHoney

1 Answers

-1
votes

If you know that you want to install to the app data folder why use the 'ProgramFilesFolder'?

This will only confuse you (or any other person that will maintain your code) - try using the 'AppDataFolder' instead.