aufziehvogel
aufziehvogel

Reputation: 7297

Cannot customize installation directory in WixUI_InstallDir, even though all uppercase

I use a very basic Wix configuration to test an installer, but I cannot change the default installation location in any way. It always installs to C:\Program Files (x86)\Project Name, no matter what I do. The variable is in only uppercase letters, INSTALLFOLDER.

I also tried it with both secure="yes" and secure="no".

I also tried it on a fresh VM where this program has never been installed before. Also installs to the C:\Program Files (x86)\Project Name only.

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
    <Product Id="94B11B8E-FD40-4840-96E4-1C89A62B1EBD" Name="Project Name" Language="1033" Version="1.0.0.0" Manufacturer="Company Name" UpgradeCode="7dda6b29-4fa7-45d1-a2f7-9e03ccf88289">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

        <MajorUpgrade DowngradeErrorMessage="A newer version of Project Name is already installed." />
        <MediaTemplate />

        <UIRef Id="WixUI_InstallDir" />
        <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
        <WixVariable Id="WixUILicenseRtf" Value="License.rtf" />

        <Feature Id="ProductFeature" Title="Project Name" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
        </Feature>
    </Product>

    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="Project Name"/>
            </Directory>
        </Directory>
    </Fragment>

    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
            <Component Id="ProductComponent" Guid="3E000548-22E3-4424-BF9F-748D92E213D0">
                <File Source="$(var.ProjectName.TargetPath)" />
            </Component>
        </ComponentGroup>
    </Fragment>
</Wix>

Installed Wix version is 3.10.1.2213.

In the Verbose log file from the installer I get the following events:

MSI (c) (F8:2C) [12:55:40:067]: PROPERTY CHANGE: Modifying INSTALLFOLDER property. Its current value is 'C:\Program Files (x86)\Project Name\'. Its new value: 'C:\Program Files (x86)\'.
MSI (c) (F8:2C) [12:55:42:610]: PROPERTY CHANGE: Modifying INSTALLFOLDER property. Its current value is 'C:\Program Files (x86)\'. Its new value: 'C:\Program Files (x86)\Project Name\'.
MSI (c) (F8:2C) [12:55:45:606]: PROPERTY CHANGE: Modifying INSTALLFOLDER property. Its current value is 'C:\Program Files (x86)\Project Name\'. Its new value: 'C:\Program Files (x86)\saafasdsafdfsafd\'.

[...]

Action 12:55:49: ExecuteAction. 
Action start 12:55:49: ExecuteAction.
[...]
MSI (c) (F8:C0) [12:55:49:366]: Switching to server: INSTALLFOLDER="C:\Program Files (x86)\saafasdsafdfsafd\" TARGETDIR="C:\" CURRENTDIRECTORY="D:\" CLIENTUILEVEL="0" CLIENTPROCESSID="3832" USERNAME="somename" SOURCEDIR="D:\" ACTION="INSTALL" EXECUTEACTION="INSTALL" ROOTDRIVE="C:\" INSTALLLEVEL="1" SECONDSEQUENCE="1" WIXUI_INSTALLDIR_VALID="1"  ADDLOCAL=ProductFeature  
[...]
MSI (s) (CC:68) [12:55:49:600]: ******* RunEngine:
       ******* Product: D:\Project Name.msi
       ******* Action: INSTALL
       ******* CommandLine: **********
[...]
MSI (s) (CC:68) [12:56:24:861]: Command Line: INSTALLFOLDER=C:\Program Files (x86)\saafasdsafdfsafd\ TARGETDIR=C:\ CURRENTDIRECTORY=D:\ CLIENTUILEVEL=0 CLIENTPROCESSID=3832 USERNAME=somename SOURCEDIR=D:\ ACTION=INSTALL EXECUTEACTION=INSTALL ROOTDRIVE=C:\ INSTALLLEVEL=1 SECONDSEQUENCE=1 WIXUI_INSTALLDIR_VALID=1 ADDLOCAL=ProductFeature ACTION=INSTALL 
[...]
MSI (s) (CC:68) [12:56:24:861]: Ignoring disallowed property INSTALLFOLDER
[...]
Action 12:56:24: CostFinalize. Computing space requirements
Action start 12:56:24: CostFinalize.
[...]
MSI (s) (CC:68) [12:56:24:876]: Dir (target): Key: INSTALLFOLDER    , Object: C:\Program Files (x86)\Project Name\
[...]
Property(S): INSTALLFOLDER = C:\Program Files (x86)\Project Name\
[...]
Property(C): INSTALLFOLDER = C:\Program Files (x86)\saafasdsafdfsafd\

Anyone knows what's going wrong? What about this disallowed property line? Mark that I get this line in both these versions:

<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" Secure="yes" />

and

<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />

Upvotes: 0

Views: 674

Answers (1)

aufziehvogel
aufziehvogel

Reputation: 7297

If you add a property with the same name as the folder ID and set this one Secure, it will work:

<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<Property Id="INSTALLFOLDER" Secure="yes" />

Upvotes: 3

Related Questions