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

Rob Mensching rob at firegiant.com
Tue Sep 17 05:36:27 PDT 2019


If you don't have a per-user package in your Bundle you don't have a per-user Bundle, you have a per-machine Bundle. And that will always need to elevate.

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

-----Original Message-----
From: Camille Zanni <CaZ at schneider.ch> 
Sent: Monday, September 16, 2019 11:51 PM
To: Rob Mensching <rob at firegiant.com>
Subject: AW: Why is the Bootstrapper always asking for elevation?

I don't have a per-user package. I only have to NetFx472Web package. Or what do you mean? 

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

-----Ursprüngliche Nachricht-----
Von: Rob Mensching <rob at firegiant.com> 
Gesendet: Dienstag, 17. September 2019 08:44
An: Camille Zanni <CaZ at schneider.ch>
Betreff: RE: Why is the Bootstrapper always asking for elevation?

Where is the per-user package to be installed?
_____________________________________________________________
 Short replies here. Complete answers over there: http://www.firegiant.com/


-----Original Message-----
From: Camille Zanni <CaZ at schneider.ch> 
Sent: Monday, September 16, 2019 11:03 PM
To: Rob Mensching <rob at firegiant.com>
Subject: AW: Why is the Bootstrapper always asking for elevation?

Thanks! 

The log says

[5C04:6DA0][2019-09-17T07:52:18]i200: Plan begin, 1 packages, action: Install
[5C04:6DA0][2019-09-17T07:52:18]w321: Skipping dependency registration on package with no dependency providers: NetFx472Web
[5C04:6DA0][2019-09-17T07:52:18]i201: Planned package: NetFx472Web, state: Present, default requested: Present, ba requested: Present, execute: None, rollback: None, cache: No, uncache: No, dependency: None
[5C04:6DA0][2019-09-17T07:52:18]i207: Planned related bundle: {6957140f-fa95-47c4-abd3-73b86ec13590}, type: Upgrade, default requested: None, ba requested: None, execute: None, rollback: None, dependency: None ...
[5C04:6DA0][2019-09-17T07:52:18]i207: Planned related bundle: {dfa9f0b0-4816-4e08-aeb1-9353f8af1876}, type: Upgrade, default requested: None, ba requested: None, execute: None, rollback: None, dependency: None
[5C04:6DA0][2019-09-17T07:52:18]i207: Planned related bundle: {f48f190f-08ce-406e-a484-473df95b565f}, type: Upgrade, default requested: None, ba requested: None, execute: None, rollback: None, dependency: None
[5C04:6DA0][2019-09-17T07:52:18]i207: Planned related bundle: {fc5d276f-c435-40d4-ad09-093116c9bfc9}, type: Upgrade, default requested: None, ba requested: None, execute: None, rollback: None, dependency: None
[5C04:6DA0][2019-09-17T07:52:18]i207: Planned related bundle: {fdcbd067-9d67-43c3-b66d-faf951fa64a0}, type: Upgrade, default requested: None, ba requested: None, execute: None, rollback: None, dependency: None
[5C04:6DA0][2019-09-17T07:52:18]i299: Plan complete, result: 0x0

NetFx472Web is present and there is no other package, so why does it prompt for elevation? 

-----Ursprüngliche Nachricht-----
Von: Rob Mensching <rob at firegiant.com>
Gesendet: Montag, 16. September 2019 18:46
An: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Cc: Camille Zanni <CaZ at schneider.ch>
Betreff: RE: Why is the Bootstrapper always asking for elevation?

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