[wix-users] Why is the Bootstrapper always asking for elevation?

Rob Mensching rob at firegiant.com
Mon Sep 16 09:46:01 PDT 2019


Bundle log file should show you the packages it plans to install. If any per-machine packages are to be installed, it will prompt for elevation.

_____________________________________________________________
 Short replies here. Complete answers over there: http://www.firegiant.com/

-----Original Message-----
From: wix-users <wix-users-bounces at lists.wixtoolset.org> On Behalf Of Camille Zanni via wix-users
Sent: Monday, September 16, 2019 6:44 AM
To: wix-users at lists.wixtoolset.org
Cc: Camille Zanni <CaZ at schneider.ch>
Subject: [wix-users] Why is the Bootstrapper always asking for elevation?

Hello,

I created a Test-Bootstrapper to learn how Burn and custom Bootstrapper work, it should only install .Net 4.7.2 and start an already existing Exe.
Why is the bootstrapper always asking for elevation even if .Net is already installed?
I tried to change PerMachine of my ExePackage to false, but then the .Net installation can not be elevated and fails, but the bootstrapper is not asking for elevation.

Thank you in advance

My bundle.wxs looks like this
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
     xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
       <Bundle Name="Bootstrapper"
          Version="1.0"
          Manufacturer="Test"
          UpgradeCode="***"
          Condition="VersionNT >= v6.1"
          DisableModify="yes"
          DisableRemove="yes">

    <BootstrapperApplicationRef Id ="ManagedBootstrapperApplicationHost" >
      <Payload SourceFile ="$(var.TargetDir)\CustomBootstrapperApplication\CustomBootstrapperApplication.dll"/>
      <Payload SourceFile="$(var.TargetDir)\CustomBootstrapperApplication\BootstrapperCore.config" />
      <Payload SourceFile="$(var.TargetDir)\CustomBootstrapperApplication\Microsoft.Deployment.WindowsInstaller.dll" />
    </BootstrapperApplicationRef>

    <Variable Name="CommandLineArg" bal:Overridable="yes" Type="string" Value="" />

    <Chain>
      <PackageGroupRef Id="NetFx472Web"/>
             </Chain>
       </Bundle>
</Wix>

And the NetFx472Web is located in a separate file:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

  <!--
        .NET Framework installation state properties

        Official documentation can be found at the following location:

           .NET Framework 4.5/4.5.1/4.5.2/4.6/4.6.1/4.6.2/4.7/4.7.1/4.7.2 - http://msdn.microsoft.com/en-us/library/w0x726c2(v=vs.110).aspx
    -->

  <?define NetFx472MinRelease = 461808 ?>
  <?define NetFx472WebLink = http://go.microsoft.com/fwlink/?LinkId=863262 ?>
  <?define NetFx472RedistLink = http://go.microsoft.com/fwlink/?LinkId=863265 ?>
  <?define NetFx472EulaLink = http://referencesource.microsoft.com/license.html ?>

  <Fragment>
    <PropertyRef Id="WIXNETFX4RELEASEINSTALLED" />
    <Property Id="WIX_IS_NETFRAMEWORK_472_OR_LATER_INSTALLED" Secure="yes" />
    <SetProperty Id="WIX_IS_NETFRAMEWORK_472_OR_LATER_INSTALLED" Value="1" After="AppSearch">
      WIXNETFX4RELEASEINSTALLED >= "#$(var.NetFx472MinRelease)"
    </SetProperty>
  </Fragment>

  <Fragment>
    <util:RegistrySearchRef Id="NETFRAMEWORK45"/>

    <WixVariable Id="WixMbaPrereqPackageId" Value="NetFx472Web" />
    <WixVariable Id="WixMbaPrereqLicenseUrl" Value="$(var.NetFx472EulaLink)" Overridable="yes" />
    <WixVariable Id="NetFx472WebDetectCondition" Value="NETFRAMEWORK45 >= $(var.NetFx472MinRelease)" Overridable="yes" />
    <WixVariable Id="NetFx472WebInstallCondition" Value="" Overridable="yes" />
    <WixVariable Id="NetFx472WebPackageDirectory" Value="redist\" Overridable="yes" />

    <PackageGroup Id="NetFx472Web">
      <ExePackage
          InstallCommand="/q /norestart /ChainingPackage "[WixBundleName]" /log "[NetFx472FullLog].html""
          UninstallCommand="/uninstall /q /norestart /ChainingPackage "[WixBundleName]" /log "[NetFx472FullLog].html""
          PerMachine="yes"
          DetectCondition="!(wix.NetFx472WebDetectCondition)"
          InstallCondition="!(wix.NetFx472WebInstallCondition)"
          Id="NetFx472Web"
          Vital="yes"
          Permanent="yes"
          Protocol="netfx4"
          DownloadUrl="$(var.NetFx472WebLink)"
          LogPathVariable="NetFx472FullLog"
          Compressed="no"
          Name="!(wix.NetFx472WebPackageDirectory)NDP472-KB4054531-Web.exe">
        <RemotePayload
          CertificatePublicKey="C090C1A2CAFA9B967D9C87C7FE02F7C01FBDE4F2"
          CertificateThumbprint="5EAD300DC7E4D637948ECB0ED829A072BD152E17"
          Description="Microsoft .NET Framework 4.7.2 Setup"
          Hash="507ECDADC23A27C2283BA130A2AA51650E6BC05B"
          ProductName="Microsoft .NET Framework 4.7.2"
          Size="1447320"
          Version="4.7.3062.0" />
      </ExePackage>
    </PackageGroup>
  </Fragment>
</Wix>

In my CustomBootstrapper.cs I implemented the functions needed and starting an new Process in the ApplyComplete.


    private void DetectCompleted(object sender, DetectCompleteEventArgs e)
    {
      DetectComplete -= DetectCompleted;

      PlanComplete += PlanCompleted;
      Engine.Plan(RunMode);
    }

    private void PlanCompleted(object sender, PlanCompleteEventArgs args)
    {
      PlanComplete -= PlanCompleted;

      ApplyComplete += ApplyCompleted;

      Engine.Apply(IntPtr.Zero);
    }

    private void ApplyCompleted(object sender, ApplyCompleteEventArgs applyCompleteEventArgs)
    {
      ApplyComplete -= ApplyCompleted;

      if (applyCompleteEventArgs.Status >= 0)
      {
        if (RunMode == LaunchAction.Install ||
            RunMode == LaunchAction.Repair ||
            RunMode == LaunchAction.Modify)
        {
         Process secondProc = new Process();
          secondProc.StartInfo.FileName = "test.exe";
         secondProc.Start();
        }

        Engine.Quit((int)ActionResult.Success);
      }
   }


____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/



More information about the wix-users mailing list