3

I'm working with WiX 3.8 and I want to give the user the option of installing a package per-user or per-machine. Per the docs, I have the following test .wxs file:

<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>

    <Product Name='Test' Id='D96B1E41-D392-4841-A526-D9BD50824163' UpgradeCode='FBCC53EC-6365-4D63-A584-F39F9984588B'
        Language='1033' Codepage='1252' Version='1.0' Manufacturer='Test Manufacterer'>

        <Package Id='*' Keywords='Installer'
            Description="Test Installer" InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />

        <Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
        <Property Id='DiskPrompt' Value="Test Installation [1]" />

        <Property Id="ApplicationFolderName" Value="Test" />
        <Property Id="WixAppFolder" Value="WixPerUserFolder" />

        <Directory Id='TARGETDIR' Name='SourceDir'>
            <Directory Id='ProgramFilesFolder' Name='PFiles'>
                <Directory Id='APPLICATIONFOLDER' Name='Test'>
                    <Component Id='Test' Guid='3A810A32-0514-4616-993C-B5BBACB74FC6'>
                        <File Id='TestFile' Name='test.txt' DiskId='1' Source='test.txt' KeyPath='yes' />
                    </Component>
                </Directory>
            </Directory>
        </Directory>

        <Feature Id='Complete' Title='Main Program' Description='The main program.'
            Display='collapse' Level='1' ConfigurableDirectory='APPLICATIONFOLDER'>
            <ComponentRef Id='Test' />
        </Feature>

        <UIRef Id="WixUI_Advanced" />
    </Product>
</Wix>

I'm building the MSI with the following command line:

candle test.wxs && light -ext WixUIExtension test.wixobj

This works well and succeeds without any errors or warnings, but when I run the MSI as a restricted user and select the "Install just for you" option, I'm still prompted for the credentials of a superuser when I click Install. If I provide the proper credentials, the program is installed in the user's AppData folder as expected. Why am I being prompted for privilege elevation? Is there any way to change this behavior?

cqcallaw
  • 1,463
  • 3
  • 18
  • 29

1 Answers1

0

You need Package InstallPrivilege set to Limited to tell Windows that the MSI can be installed by limited users. So then you won't see the UAC prompt, and the install will fail if a limited user tries to do something that violates security.

PhilDW
  • 20,260
  • 1
  • 18
  • 28
  • 3
    Hmm, this doesn't quite work the way I would like: adding the limited InstallPrivileges attribute forces me to install the package per-user instead of giving me the option to install per-user or per-machine. – cqcallaw Nov 01 '14 at 01:45