Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
389 views
in Technique[技术] by (71.8m points)

c# - WiX silent install unable to launch built in .EXE: WiX v3

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

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

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.

Launch after install, with no UI? http://wixtoolset.org/documentation/manual/v3/howtos/ui_and_localization/run_program_after_install.html

Here is my code below

<?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>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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

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

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

As of Windows 10, Version 1607:


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: 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.

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.


Some Links:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...