WiX 静默安装无法启动内置 .EXE:WiX v3 [英] WiX silent install unable to launch built in .EXE: WiX v3

查看:22
本文介绍了WiX 静默安装无法启动内置 .EXE:WiX v3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这可能看起来像重复,但我几乎在网上尝试过任何东西,包括以下链接:

I know this might seem like a duplicate, but I have tried almost anything online including the following links below:

使用双击时,安装成功完成并启动我的 EXE,它是一个 WPF UI.

When using double click, the installation completes successfully and it launches my EXE which is a WPF UI.

问题是,如果在命令行中运行,WiX 安装程序会安装,但我的 WPF 不会启动.没有驱动程序更新.请注意,我有自定义开关,例如/?/q/forerestart/noreboot 在我的 WPF 中.

The problem is that if run in the command line, the WiX installer installs but my WPF doesn't launch. There is no driver update. Note that I have custom switches such as /? /q /forerestart /noreboot in my WPF.

安装后启动,没有 UI?http://wixtoolset.org/documentation/manual/v3/howtos/ui_and_localization/run_program_after_install.html

下面是我的代码

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"><?define INF_INSTALLER_TargetDir=$(var.INF_INSTALLER.TargetDir)?>
    <Product Id="guid here" Name="INF_INSTALLER" Language="1033" Version="1.1.1.3" Manufacturer="Intel Corporation" UpgradeCode="guid here">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine"  InstallPrivileges="elevated" />

        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <MediaTemplate EmbedCab="yes" />

    <!--User Agrrement-->
    <WixVariable Id="WixUILicenseRtf" Value="$(var.ProjectDir)EULAsingleuselicense.rtf" />
    <WixVariable Id="WixUIBannerBmp" Value="imagesBanner.jpg" />
    <WixVariable Id="WixUIDialogBmp" Value="imagesBackground.png" />


    <!--Chosing the UI version-->
    <!-- Step 2: Add UI to your installer / Step 4: Trigger the custom action -->
    <!-- UI to installer -->
    <UI>
      <UIRef Id="WixUI_Minimal" />
      <!-- Launch the applicaiton -->
      <Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">NOT Installed</Publish>
    </UI>
    <!--<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch INF INSTALLER" /> -->

    <!-- Step 3: Include the custom action -->
    <Property Id="WixShellExecTarget" Value="[#INF_INSTALLER.exe]" />
    <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" />
    <CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />



    <Feature Id="ProductFeature" Title="INF INSTALLER" Level="1">
      <ComponentGroupRef Id="ProductComponents" />
      <ComponentRef Id="ApplicationShortcut" />
      <!--<ComponentRef Id="ApplicationShortcutDesktop" /> -->
    </Feature>
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="TempFolder">
        <Directory Id="ManufacturerFolder" Name="INF_INSTALLER">
          <Directory Id="INSTALLFOLDER" Name="INF_INSTALLER" />
        </Directory>
        <Directory Id="ProgramMenuFolder">
          <Directory Id="ApplicationProgramsFolder" Name="!(bind.property.ProductName)" />
        </Directory>
        <!--<Directory Id="DesktopFolder" Name="Desktop" />-->
      </Directory>
    </Directory>
  </Fragment>

  <Fragment>
    <DirectoryRef Id="ApplicationProgramsFolder">
      <Component Id="ApplicationShortcut" Guid="guid here">
        <Shortcut Id="ApplicationStartMenuShortcut" Name="!(bind.property.ProductName)" Description="INF INSTALLER" Target="[INSTALLFOLDER]INF_INSTALLER.exe" WorkingDirectory="INSTALLFOLDER" />
        <RemoveFolder Id="RemoveApplicationProgramsFolder" Directory="ApplicationProgramsFolder" On="uninstall" />
        <RegistryValue Root="HKCU" Key="SoftwareINF_INSTALLER" Name="installed" Type="integer" Value="1" KeyPath="yes" />
      </Component>
    </DirectoryRef>
    <!--<DirectoryRef Id="DesktopFolder">
      <Component Id="ApplicationShortcutDesktop" Guid="guid here">
        <Shortcut Id="ApplicationDesktopShortcut" Name="!(bind.property.ProductName)" Description="INF INSTALLER" Target="[INSTALLFOLDER]INF_INSTALLER.exe" WorkingDirectory="INSTALLFOLDER" />
        <RemoveFolder Id="RemoveDesktopFolder" Directory="DesktopFolder" On="uninstall" />
        <RegistryValue Root="HKCU" Key="SoftwareINF_INSTALLER" Name="InstalledCompleted" Type="integer" Value="1" KeyPath="yes" />
      </Component>
    </DirectoryRef>-->
  </Fragment>

    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
            <Component Id="windowscert.cer" Guid="guid here">
              <File Id="windowscert.cer" Name="windowscert.cer" Source="$(var.INF_INSTALLER_TargetDir)windowscert.cer" />
            </Component>
            <Component Id="myinf.inf" Guid="guid here">
              <File Id="myinf.inf" Name="myinf.inf" Source="$(var.INF_INSTALLER_TargetDir)myinf.inf" />
            </Component>
            <Component Id="INF_INSTALLER.exe" Guid="guid here">
              <File Id="INF_INSTALLER.exe" Name="INF_INSTALLER.exe" Source="$(var.INF_INSTALLER_TargetDir)INF_INSTALLER.exe" />
            </Component>
            <Component Id="INF_INSTALLER.exe.config" Guid="guid here">
              <File Id="INF_INSTALLER.exe.config" Name="INF_INSTALLER.exe.config" Source="$(var.INF_INSTALLER_TargetDir)INF_INSTALLER.exe.config" />
            </Component>
            <Component Id="INF_INSTALLER.pdb" Guid="guid here">
              <File Id="INF_INSTALLER.pdb" Name="INF_INSTALLER.pdb" Source="$(var.INF_INSTALLER_TargetDir)INF_INSTALLER.pdb" />
            </Component>
        </ComponentGroup>
    </Fragment>

  <Fragment>

    <CustomAction Id="LaunchFile" FileKey="INF_INSTALLER.exe" ExeCommand="/quiet" Return="asyncNoWait" />

    <Property Id="WixSilentExecCmdLine" Value="/silent" Hidden="yes"/>
    <CustomAction Id="SilentExecExample" BinaryKey="WixCA" DllEntry="WixSilentExec" Execute="immediate" Return="check"/>

    <InstallExecuteSequence>

      <Custom Action="LaunchFile" After="InstallFinalize">NOT  Installed</Custom>
      <Custom Action="SilentExecExample" After="TheActionYouWantItAfter"/>
      <RemoveExistingProducts After="InstallFinalize" />

    </InstallExecuteSequence>


  </Fragment>
</Wix>

推荐答案

配置错误:这条线永远不会运行 - 无论是静默模式还是交互模式:

Faulty Configuration: This line would never run - regardless of silent or interactive mode:

<Custom Action="SilentExecExample" After="TheActionYouWantItAfter"/>

After 属性必须指定一个有效的 StandardActionCustomAction 名称.

The After attribute must specify a valid StandardAction or CustomAction name.

静默模式失败:下面的行将在静默模式下失败,因为您在 InstallFinalize 之后运行它.在这种情况下,它不会在提升的情况下运行(除非您从提升的 cmd.exe 提示符启动安装程序),因此安装程序无法完成(安装程序仅在 InstallInitialize 之间运行提升InstallExecuteSequence 中的 code> 和 InstallFinalize):

Silent Mode Failure: The line below will fail in silent mode because you run it after InstallFinalize. In this case it will not run with elevation (unless you launch the setup from an elevated cmd.exe prompt) and the setup can therefore not complete (the setup runs elevated only between InstallInitialize and InstallFinalize in the InstallExecuteSequence):

<Custom Action="LaunchFile" After="InstallFinalize">NOT  Installed</Custom>

还有一些你应该知道的事情.请阅读以下内容.

There are a few more things you should know. Please read the below.

Windows 更新分发:据记录,微软似乎希望将来通过 Windows 更新分发驱动程序,或者至少通过一个独立的包而不需要对于安装程序.

Windows Update Distribution: For the record, it appears Microsoft wants driver distribution to happen via Windows Update in the future, or at least via a standalone package without the need for an installer.

从 Windows 10 版本 1607 开始:

As of Windows 10, Version 1607:

  • DIFx 工具 不再包含在 WDK(Windows 驱动程序工具包)中.
    • DIFx tools are no longer included in the WDK (Windows Driver Kit).
      • Some important tidbits if you choose to use DIFx anyway.
      • 硬件认证
      • 协同驱动开发
      • 通过 Windows 更新分发驱动程序

      驱动元素:WiX 目前有 Driver Element 用于驱动安装.据我所知,它在底层使用了 DIFx 框架.在 github 上找到的一个实用的小例子.com.我从来没有使用过这个功能.FireGiant 的 WiX 扩展包 具有更高级的驱动程序安装支持.我从来没有尝试过.

      Driver Element: WiX currently has the Driver Element for driver installation. It uses the DIFx framework under the hood - as far as I know. A small, practical example found on github.com. I have never used this feature. FireGiant's WiX Expansion Pack features more advanced driver installation support. Never tried by me.

      DPInst.exe:我不熟悉 INF_INSTALLER.exe - 那是您的专有组件吗已经创造出来了?也可以使用 DPInst.exe 工具来自 DIFx 框架.它可以通过 MSI 内的自定义操作调用,也可以直接从 Burn(WiX Bundle - 换句话说,不是 MSI 的一部分)运行.在 github.com 上找到的一个相当简短的示例.

      DPInst.exe: I am not familiar with INF_INSTALLER.exe - is that a proprietary component you have created? It is also possible to install signed drivers using the DPInst.exe tool from the DIFx framework. It can be called via custom actions inside an MSI or it can probably be run directly from Burn (WiX Bundle - in other words not part of an MSI). A fairly short example found on github.com.

      小提示:搜索 "DPInst.exe http://schemas.microsoft.com/wix/2006/wi"会产生大量的命中.根据我的经验,你可以使用这个 github 搜索技术来查找几乎任何东西的帮助.不过要很关键,我会利用节省的时间进行额外的测试.只是我的 2 美分.

      A Little Tip: Searching for "DPInst.exe http://schemas.microsoft.com/wix/2006/wi" will yield heaps of hits. You can use this github search technique to find help with pretty much anything in my experience. Be critical though, and I would use the time saved to do extra testing. Just my 2 cents.

      一些链接:

      这篇关于WiX 静默安装无法启动内置 .EXE:WiX v3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆