Wix 安装程序忽略 ALLUSERS 参数

问题描述 投票:0回答:1

我有非常简单的 Wix 安装程序,它将安装程序和脚本(install.cmd)提取到 c:\Windows emp 并运行脚本。

如果运行Wix安装程序,INSTALL.log如下所示:

Property(S): WixPerUserFolder = C:\windows\system32\config\systemprofile\AppData\Local\Apps\Remote Desktop

如果在命令行中运行install.cmd,INSTALL.log是这样的:

Property(S): WixPerUserFolder = C:\Users\Admin\AppData\Local\Apps\Remote Desktop

Wix 安装程序似乎忽略了脚本中指定的 ALLUSERS 参数。这个问题有什么解决办法吗?

AppInstaller.wxs

<?xml version='1.0'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
   <Product Id='*' UpgradeCode="3508345-7155-452D-879E-7AC8592FC9B6" 
        Name='AppInstaller' Language='1033' Version='1.0.0.0' 
        Manufacturer='ABC'> 
    
    <Package Description='AppInstaller script' InstallerVersion='200' InstallScope="perMachine" Compressed='yes' />
    <Property Id="AllUSERS" Value="1"/>

    <Media Id='1' Cabinet='setup.cab' EmbedCab='yes' />

    <!-- Package components: define which files to be included in self-extracting package. -->
    <Directory Id='TARGETDIR' Name='SourceDir'>
        <Directory Id="WindowsFolder">
            <Directory Id="INSTALLLOCATION" Name="Temp">
                <Component Id='AppInstallerComponent' DiskId='1' Guid=''>
                    <File Id="File0" Name="RemoteDesktop_1.2.5255.0_x64.msi" Source="Files\RemoteDesktop_1.2.5255.0_x64.msi" />
                </Component>
            </Directory>
        </Directory>


        <Directory Id="TempFolder">
            <Directory Id="tmpdir" Name="~_tmpdir">
                <Component Id='AppInstallScript' DiskId='1' Guid=''>
                    <File Id="File100" Name="install.cmd" Source="Files\install.cmd" />
                </Component>
            </Directory>  
        </Directory>  

        
    </Directory>

    <Feature Id='InstallFeature' Title='Install Feature' Level='1'>
        <ComponentRef Id='AppInstallerComponent' />
        <ComponentRef Id='AppInstallerScript' />
    </Feature>

    <!-- Run Action: define which file to run after the package is extracted -->
    <CustomAction Id="RunWrapExe" Return="asyncNoWait" Execute="deferred" 
                  FileKey="File100" ExeCommand=""
                  HideTarget="no" Impersonate="no" />

    <InstallExecuteSequence>
        <Custom Action="RunWrapExe" 
                After="InstallFiles">NOT REMOVE~="ALL"</Custom>
        <PublishComponents Suppress="yes" />
        <PublishFeatures Suppress="yes" />
        <PublishProduct Suppress="yes" />
        <RegisterProduct Suppress="yes" />
        <RegisterUser Suppress="yes" />
    </InstallExecuteSequence>

   </Product>
</Wix>

安装.cmd

REM The following is required in all INSTALL.CMD files
Call c:\system.sav\util\SetVariables.cmd
Set block=%~dp0
Set TMP=C:\Windows\Temp
Set TEMP=%TMP%
 
REM Install Remote Desktop & capture logs
start /wait msiexec.exe ALLUSERS=1 /i C:\Windows\Temp\RemoteDesktop_1.2.5255.0_x64.msi /l* C:\Windows\Temp\INSTALL.log /quiet /norestart

REM if %ERRORLEVEL% equ 0 del /F /Q C:\Windows\Temp\RemoteDesktop_1.2.5255.0_x64.msi

日志对比:

installation wix windows-installer
1个回答
0
投票

为了能够从命令行在 .msi 中设置属性,必须将其定义为全部大写字母。在命令行中设置 ALLUSERS=1 实际上会创建一个值为 1 的新属性 ALLUSERS,而不是为属性 AllUSERS 设置值 1。在日志中您应该能够看到发生的情况。

© www.soinside.com 2019 - 2024. All rights reserved.