第二个海拔对话框

Second elevation dialog

我有一个简单的应用程序,我在其中安装了一个 exe,运行 它在安装结束时。但是当安装完成后,它会显示 app.exe 的第二个提升对话框,我不希望它显示,这是我的 Wix 代码。

<?xml version="1.0" encoding="UTF-8"?>

<!-- The following three sections are from the How To: Add a File to Your Installer topic-->
<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <Directory Id="APPLICATIONROOTDIRECTORY" Name="My Application Name"/>
  </Directory>
</Directory>

<DirectoryRef Id="APPLICATIONROOTDIRECTORY">
  <Component Id="app.exe" Guid="12345678-1234-1234-1234-222222222223">
    <File Id="app.exe" Source="MySourceFiles\app.exe" KeyPath="yes" Checksum="yes"/>
  </Component>
</DirectoryRef>
<Feature Id="MainApplication" Title="Main Application" Level="1">
  <ComponentRef Id="app.exe" />
</Feature>
<!-- Step 2: Add UI to your installer / Step 4: Trigger the custom action -->
<InstallExecuteSequence>
    <Custom Action='LaunchInstalledExe' After='InstallFinalize'/>
  </InstallExecuteSequence>

  <CustomAction Id="LaunchInstalledExe"
     FileKey="app.exe"

     ExeCommand=""
     Return="ignore" />

该可执行文件在 InstallFinalize 之后 运行,因此默认情况下不会提升它,而且它显然有一个提升清单,因此它会请求提升。我会在 InstallFinalize 之前尝试(而不是立即)以查看是否可以解决问题,您可能也希望模拟它。 InstallFinalize 之后是比较安全的地方。问题是管理员可以启动安装(或通过组策略将其推出)然后走开,让有限的用户可以访问程序 运行ning 提升,可以做一些有限用户不应该被允许的事情去做。例如,我当然不希望为受限用户启动安装,这会导致该用户后来可以访问可以配置数据库安全性的程序。因此,从安全角度来看,InstallFinalize 后产生的提升提示是合适的。但这完全取决于您的客户及其环境和产品本身。