为什么使用WixUI_Advanced构建的MSI的每个用户安装需要提升权限?

时间:2014-10-31 03:57:01

标签: wix installation windows-installer elevated-privileges

我正在使用WiX 3.8,我希望为用户提供按用户或每台计算机安装软件包的选项。根据{{​​3}},我有以下测试.wxs文件:

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

我使用以下命令行构建MSI:

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

这很有效并且没有任何错误或警告就成功了,但当我以受限制的用户身份运行MSI并选择&#34;仅为您安装时#34;选项,当我单击“安装”时,我仍然会提示输入超级用户的凭据。如果我提供了正确的凭据,程序将按预期安装在用户的AppData文件夹中。为什么我被提示提升权限?有没有办法改变这种行为?

1 个答案:

答案 0 :(得分:1)

您需要将Package InstallPrivilege设置为Limited才能告诉Windows MSI可以由受限用户安装。因此,您无法看到UAC提示,如果受限用户尝试执行违反安全性的操作,安装将失败。