Hello everyone,

I'm attempting to write my first bootstrapper (YAY) and I've decided that the 
managed bootstrapper would be ideal for our organization.  I'm trying to get a 
quick and dirty sample up and running with a dummy MSI inside that installs its 
own WXS file.

Running WiX 3.8 RTM with VS2013 on Win7x64.

So my issue is this:
The prerequisite dialog appears with the license.  I can click "Install" and 
the UAC dialog appears.  The progress bar shows up but goes nowhere for about 
10-15 seconds and eventually the process just dies.

I have .NET 3.5.1 as a prerequisite.  I have this version of the framework 
installed on my machine as well as 4.5.1 though our product will only really 
need 3.5 for runtime.

I'm not getting any compiler errors or anything.  I have tried this with 
supportedRuntime set to:
<supportedRuntime version="v4.0" />
OR
<supportedRuntime version="v2.0.50727" />

And the behaviour does not change.

Has anyone else seen this behaviour?

================== Bundle.wxs
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"; 
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"; 
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension";>
  <Bundle Name="ExpressMBA" Version="1.0.0.0" Manufacturer="Test" 
UpgradeCode="98f562b0-179f-4295-ba70-ee5a957d1b10">
    <BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">
      <Payload 
SourceFile="..\BootstrapperUX\bin\Debug\BootstrapperUX.dll.config"/>
      <Payload SourceFile="..\BootstrapperUX\bin\Debug\BootstrapperUX.dll"/>
      <Payload SourceFile="C:\Program Files (x86)\WiX Toolset 
v3.8\SDK\Microsoft.Deployment.WindowsInstaller.dll"/>
    </BootstrapperApplicationRef>

    <Variable Name="InstallFolder" Type="string" 
Value="[ProgramFilesFolder]Test\App"/>

    <Chain>
      <PackageGroupRef Id='Netfx351Full' />
      <!--<PackageGroupRef Id="NetFx40Web" />-->
      <MsiPackage SourceFile="..\CAS\bin\Debug\CAS.msi" Compressed="no" 
Cache="yes" DisplayInternalUI="yes" EnableFeatureSelection="no" 
ForcePerMachine="yes"
                  InstallCondition="1"
                  Visible="yes" Vital="yes">
        <MsiProperty Name="INSTALLLOCATION" Value="[InstallFolder]" />
      </MsiPackage>

              </Chain>
       </Bundle>

  <Fragment>
    <!-- Managed bootstrapper requires .NET as a dependency, since it was 
written in .NET.
       WiX provides a Bootstrapper for the bootstrapper. The fragment below 
includes .NET.
       For more information or examples see Heath Stewart's blog or the WiX 
source:
       
http://blogs.msdn.com/b/heaths/archive/2011/10/28/introducing-managed-bootstrapper-applications.aspx
       -->
    <WixVariable Id="WixMbaPrereqPackageId" Value="Netfx351Full" />
    <WixVariable Id="WixMbaPrereqLicenseUrl" Value="NetfxLicense.rtf" />
    <util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework 
Setup\NDP\v3.5" Value="Version" Variable="Netfx351FullVersion" />
    <util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework 
Setup\NDP\v3.5" Value="Version" Variable="Netfx351x64FullVersion" Win64="yes" />
    <PackageGroup Id="Netfx351Full">
      <ExePackage Id="Netfx351Full" Cache="no" Compressed="yes" 
PerMachine="yes" Permanent="yes" Vital="yes"
                  
SourceFile="\\wat-bartist.watdev.ca\Build_Depot\Support\DotNetRedist\dotNetFx35.exe"
                  
DownloadUrl="http://www.microsoft.com/en-ca/download/details.aspx?id=25150";
                  
DetectCondition="(Netfx351FullVersion=&quot;3.5.30729.5420&quot;) AND (NOT 
VersionNT64 OR (Netfx351x64FullVersion=&quot;3.5.30729.5420&quot;))"
                  InstallCondition="(VersionNT >= v6.0 OR VersionNT64 >= v6.0) 
AND (NOT (Netfx351FullVersion=&quot;3.5.30729.5420&quot; OR 
Netfx351x64FullVersion=&quot;3.5.30729.5420&quot;))"/>
    </PackageGroup>
  </Fragment>

  <Fragment>
    <!-- Managed bootstrapper requires .NET as a dependency, since it was 
written in .NET.
       WiX provides a Bootstrapper for the bootstrapper. The fragment below 
includes .NET.
       For more information or examples see Heath Stewart's blog or the WiX 
source:
       
http://blogs.msdn.com/b/heaths/archive/2011/10/28/introducing-managed-bootstrapper-applications.aspx
       -->
    <WixVariable Id="WixMbaPrereqPackageId" Value="Netfx451Full" />
    <WixVariable Id="WixMbaPrereqLicenseUrl" Value="NetfxLicense.rtf" />
    <util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework 
Setup\NDP\v4\Full" Value="Version" Variable="Netfx4FullVersion" />
    <util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework 
Setup\NDP\v4\Full" Value="Version" Variable="Netfx4x64FullVersion" Win64="yes" 
/>
    <PackageGroup Id="Netfx451Full">
      <ExePackage Id="Netfx451Full" Cache="yes" Compressed="yes" 
PerMachine="yes" Permanent="yes" Vital="yes"
                  
SourceFile="\\wat-bartist.watdev.ca\Build_Depot\Support\DotNetRedist\NDP451-KB2858728-x86-x64-AllOS-ENU.exe"
                  
DownloadUrl="http://www.microsoft.com/en-us/download/details.aspx?id=40779";
                  DetectCondition="(Netfx4FullVersion=&quot;4.5.50938&quot;) 
AND (NOT VersionNT64 OR (Netfx4x64FullVersion=&quot;4.5.50938&quot;))"
                  InstallCondition="(VersionNT >= v6.0 OR VersionNT64 >= v6.0) 
AND (NOT (Netfx4FullVersion=&quot;4.5.50938&quot; OR 
Netfx4x64FullVersion=&quot;4.5.50938&quot;))"/>
    </PackageGroup>
  </Fragment>
</Wix>

================== BootstrapperUX.dll.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <sectionGroup name="wix.bootstrapper" 
type="Microsoft.Tools.WindowsInstallerXml.Bootstrapper.BootstrapperSectionGroup,
 BootstrapperCore">
      <section name="host" 
type="Microsoft.Tools.WindowsInstallerXml.Bootstrapper.HostSection, 
BootstrapperCore" />
    </sectionGroup>
  </configSections>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <!--<supportedRuntime version="v4.0" />-->
    <supportedRuntime version="v2.0.50727" />
  </startup>
  <wix.bootstrapper>
    <host assemblyName="BootstrapperUX">
      <!--<supportedFramework version="v4\Full" />
      <supportedFramework version="v4\Client" />-->
      <supportedFramework version="v3.5" />
      <supportedFramework version="v3.0" />
    </host>
  </wix.bootstrapper>
</configuration>

================== BootstrapperUX.dll
using Microsoft.Tools.WindowsInstallerXml.Bootstrapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Threading;

namespace Stuff.BootstrapperUX
{
    public class UX : BootstrapperApplication
    {
        /// <summary>
        /// global dispatcher
        /// </summary>
        static public Dispatcher BootstrapperDispatcher { get; private set; }

        /// <summary>
        /// entry point for our custom UI
        /// </summary>
        protected override void Run()
        {
            this.Engine.Log(LogLevel.Verbose, "Launching Equtirac UX");
            BootstrapperDispatcher = Dispatcher.CurrentDispatcher;

            MainViewModel viewModel = new MainViewModel(this);
            viewModel.Bootstrapper.Engine.Detect();

            MainView_Master view = new MainView_Master();
            view.DataContext = viewModel;
            view.Closed += (sender, e) => 
BootstrapperDispatcher.InvokeShutdown();
            view.Show();
            Dispatcher.Run();
            this.Engine.Quit(0);
        }
    }
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Tools.WindowsInstallerXml.Bootstrapper;

namespace Stuff.BootstrapperUX
{
    internal class MainViewModel : INotifyPropertyChanged
    {
        #region INotifyPropertyChanged
        public virtual event PropertyChangedEventHandler PropertyChanged;
        protected virtual void RaisePropertyChanged([CallerMemberName] string 
propertyName = null)
       {
            if (null != PropertyChanged) PropertyChanged(this, new 
PropertyChangedEventArgs(propertyName));
        }
        #endregion

        //constructor
        public MainViewModel(BootstrapperApplication bootstrapper)
        {
            this.IsThinking = false;
            this.Bootstrapper = bootstrapper;
            this.Bootstrapper.ApplyComplete += this.OnApplyComplete;
            this.Bootstrapper.DetectPackageComplete += 
this.OnDetectPackageComplete;
            this.Bootstrapper.PlanComplete += this.OnPlanComplete;
        }
        #region Properties
        private bool installEnabled;
        public bool InstallEnabled
        {
            get { return installEnabled; }
            set
            {
                installEnabled = value;
                RaisePropertyChanged("InstallEnabled");
            }
        }
        private bool uninstallEnabled;
        public bool UninstallEnabled
        {
            get { return uninstallEnabled; }
            set
            {
                uninstallEnabled = value;
                RaisePropertyChanged("UninstallEnabled");
            }
        }
        private bool isThinking;
        public bool IsThinking
        {
            get { return isThinking; }
            set
            {
                isThinking = value;
                RaisePropertyChanged("IsThinking");
            }
        }
        public BootstrapperApplication Bootstrapper { get; private set; }
        #endregion //Properties
        #region Methods
        private void InstallExecute()
        {
            IsThinking = true;
            Bootstrapper.Engine.Plan(LaunchAction.Install);
        }
        private void UninstallExecute()
        {
            IsThinking = true;
            Bootstrapper.Engine.Plan(LaunchAction.Uninstall);
        }
        private void ExitExecute()
        {
            UX.BootstrapperDispatcher.InvokeShutdown();
        }
        /// <summary>
        /// Method that gets invoked when the Bootstrapper ApplyComplete event 
is fired.
        /// This is called after a bundle installation has completed. Make sure 
we updated the view.
        /// </summary>
        private void OnApplyComplete(object sender, ApplyCompleteEventArgs e)
        {
            IsThinking = false;
            InstallEnabled = false;
            UninstallEnabled = false;
        }
        /// <summary>
        /// Method that gets invoked when the Bootstrapper 
DetectPackageComplete event is fired.
        /// Checks the PackageId and sets the installation scenario. The 
PackageId is the ID
        /// specified in one of the package elements (msipackage, exepackage, 
msppackage,
        /// msupackage) in the WiX bundle.
        /// </summary>
        private void OnDetectPackageComplete(object sender, 
DetectPackageCompleteEventArgs e)
        {
            if (e.PackageId == "DummyInstallationPackageId")
            {
                if (e.State == PackageState.Absent)
                    InstallEnabled = true;
                else if (e.State == PackageState.Present)
                    UninstallEnabled = true;
            }
        }
        /// <summary>
        /// Method that gets invoked when the Bootstrapper PlanComplete event 
is fired.
        /// If the planning was successful, it instructs the Bootstrapper 
Engine to
        /// install the packages.
        /// </summary>
        private void OnPlanComplete(object sender, PlanCompleteEventArgs e)
        {
            if (e.Status >= 0)
                Bootstrapper.Engine.Apply(System.IntPtr.Zero);
        }
        #endregion //Methods
    }
}

<Window x:Class="Stuff.MainView_Master"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation";
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml";
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008";
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006";
        mc:Ignorable="d"
        Title="Stuff - %BRAND_VALUE%" Width="800" MinWidth="800" Height="600" 
MinHeight="600">
    <Window.Resources>
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
    </Window.Resources>
    <Grid>
        <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" 
HorizontalAlignment="Right" Grid.Column="1"/>
    </Grid>
</Window>

Stephen Tunney
Nuance Communications, Inc.
Solutions Architect, Imaging Division
Waterloo, Ontario, Canada
stephen.tun...@nuance.com<mailto:stephen.tun...@nuance.com>
519-880-7463      Office
NUANCE.COM
The experience speaks for itself (tm)

------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to