我的MSI为什么提示输入管理员权限?

时间:2019-05-31 19:48:53

标签: wix windows-installer

我正在尝试让非管理员用户使用我们的MSI。

我正在使用WixUI_Advanced,但是即使选择“仅为您安装”,我仍然会收到管理员提示:

installation scope dialog

查看MSI日志,我可以看到需要海拔,但是我不知道为什么:

MSI (s) (68:54) [10:45:25:359]: Product not registered: beginning first-time install
MSI (s) (68:54) [10:45:25:359]: PROPERTY CHANGE: Deleting ALLUSERS property. Its current value is '1'.
MSI (s) (68:54) [10:45:25:359]: Product {32799511-D146-40F4-ACA7-5A76E6E38854} is not managed.
MSI (s) (68:54) [10:45:25:359]: Machine policy value 'AlwaysInstallElevated' is 0
MSI (s) (68:54) [10:45:25:359]: User policy value 'AlwaysInstallElevated' is 0
MSI (s) (68:54) [10:45:25:359]: MSI_LUA: Elevation required to install product, will prompt for credentials

有人知道为什么会提示我输入管理员权限吗?


修改

我创建了一个空的Wix项目,使用了WixUI_Advanced UI,并且遇到了同样的问题:/

1 个答案:

答案 0 :(得分:0)

  

管理员权限提示 :在下面的WiX示例中,每台计算机安装将要求并要求提升,但<强>按用户安装。


注意事项 :我个人不喜欢按用户设置。在我的主观意见中,我发现它们是边界反模式。它涉及可维护性差(升级,修补等)以及许多其他细节,例如可疑的文件夹重定向和一些其他“高修饰度”因素。高级安装人员还总结了许多限制:Advanced Installer: per-user setup limitations


WiX Issue 5481:我添加了一个答案,但删除了它。它不能正常工作。我查看了 WiX问题数据库,这是一个已知问题:https://github.com/wixtoolset/issues/issues/5481 NicMay 的最后一条评论很有趣。我在下面做了一个快速的模型,将他/她的建议进行了一些修改。

免责声明 :以下示例具有许多缺陷,仅用作 "runnable sample" 。由于我使用了快捷方式快速解决方案,因此MSI验证存在问题(使用快捷方式查看文件的安装位置,右键单击并转到 "Properties" )。自定义安装对话框中的 "Create New Folder" 按钮也有一个错误。我仍然会发布它,看看它是否对您有帮助:

  

NB! :创建新的WiX项目,添加对 WixUIExtension.dll 的引用,然后关注注释。运行安装程序,然后单击 "Advanced" 以选择按用户或按计算机安装。

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

<!--CHANGE #1: Add an UpgradeCode GUID below -->

  <Product Id="*" Name="PerUserOrPerMachine" Language="1033" Version="1.0.0.0"
           Manufacturer="Hobbit" UpgradeCode="PUT-GUID-HERE">    
    <Package InstallerVersion="200" Compressed="yes" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate EmbedCab="yes" />
    <Feature Id="ProductFeature" Title="PerUserOrPerMachine" Level="1" />      

<!--CHANGE #2: Here we channel "hacker" NicMay with his / her dialog event tweaks mentioned in the WiX issue 5481 -->

    <UI>
      <UIRef Id="WixUI_Advanced" />
      <Publish Dialog="InstallScopeDlg" Control="Next" Property="MSIINSTALLPERUSER" Value="1" Order="3">WixAppFolder = "WixPerUserFolder"</Publish>
      <Publish Dialog="InstallScopeDlg" Control="Next" Property="MSIINSTALLPERUSER" Value="{}" Order="2">WixAppFolder = "WixPerMachineFolder"</Publish>
      <Publish Dialog="InstallScopeDlg" Control="Next" Event="DoAction" Value="WixSetDefaultPerMachineFolder" Order="3">WixAppFolder = "WixPerMachineFolder"</Publish>
      <Publish Dialog="InstallScopeDlg" Control="Next" Event="DoAction" Value="WixSetDefaultPerUserFolder" Order="3">WixAppFolder = "WixPerUserFolder"</Publish>
    </UI>

    <Property Id="ApplicationFolderName" Value="PerUserPerMachine" />
    <Property Id="WixAppFolder" Value="WixPerMachineFolder" />

<!--CHANGE #3: Add components and files as appropriate -->

    <Directory Id="TARGETDIR" Name="SourceDir">

<!--CHANGE #4: Make sure DesktopFolder is defined -->

      <Directory Id="DesktopFolder" />
      <Directory Id="ProgramFilesFolder">

<!--CHANGE #5: Crucial: Make sure Directory Id is APPLICATIONFOLDER (referenced elsewhere) -->

        <Directory Id="APPLICATIONFOLDER" Name="PerUserOrPerMachine">
          <Component Feature="ProductFeature" Guid="{5A74A1EE-0AD3-4C48-9E6B-4E4E3712A8BB}">

<!--CHANGE #6: Hard coded path below for simplicity, change path or replace construct -->

            <File Source="D:\My Test Files\MyTestApplication.exe">
              <Shortcut Id="AppDesktopShortcut" Name="PerUserOrPerMachine" Directory="DesktopFolder"  />
            </File>

            <RegistryValue Root="HKCU" Key="Software\My Company\My Product" Name="installed" Type="integer" Value="1" KeyPath="yes" />
          </Component>

        </Directory>
      </Directory>
    </Directory>

  </Product>

</Wix>

链接

  • WiX Simple Setup Per User Installer(每用户设置示例-不应直接安装到用户配置文件文件夹,而应将install设置为ProgramFiles,然后允许MSI进行文件夹重定向)。
相关问题