Search code examples
wixbootstrapperburn

Burn: Run Managed Bootstrapper where Dot Net Framework 4 is not installed


I'm a newbie to Burn and learning to develop Managed Bootstrapper Application (MBA) along with Bundle package. As MBA require Dot Net Framework 4.x, we would need it to be installed on the target OS before executing Managed Interface.

Question: Is this possible to launch .Net framework 4.x installation before launching Managed Interface of Bootstrapper from within one package?

Idea: Would it be a good idea that instead of packing dotnet framework 4.x into one package, we create separate package for dotnet framework 4.xx and add our main package (containing MBA) into that as well, so that first it would launch dotnet framework 4.xx installation (if required) and then would launch our main package (as a separate exe)?

I mean, did anyone tried such thing before and got some feedback guidance?

Thanks Farrukh.


Solution

  • What you described in the Idea section is already implemented. All you need to do is include the appropriate NETFX PackageGroup and all the variables are set up for you. For example, the WiX toolset's Bundle sets up it's managed bootstrapper application in the standard way:

    <BootstrapperApplicationRef Id='ManagedBootstrapperApplicationHost'>
      <Payload Name='BootstrapperCore.config' SourceFile='WixBA.BootstrapperCore.config' />
    
      <Payload SourceFile='WixBA.dll' />
      <Payload SourceFile='License.htm' />
    </BootstrapperApplicationRef>
    

    And the first thing in the chain is a reference to the NETFX 4.0 web redist. It looks like:

    <Chain>
      <PackageGroupRef Id='NetFx40Web' />
    

    This reference is satisfied by the WixNetfxExtension. The important code in the WixNetfxExtension is the WixVariables that tell the ManagedBootstrapperApplicationHost which package in the chain is NETFX:

    <WixVariable Id="WixMbaPrereqPackageId" Value="NetFx40Web" />
    <WixVariable Id="WixMbaPrereqLicenseUrl" Value="$(var.NetFx40EulaLink)" />
    

    The ManagedBootstrapperApplicationHost (which handles the loading of your managed BA) will take care of getting the NETFX package installed if it is not already present on the machine.

    You can see how all that works in src\ext\BalExtension\mba\host\host.cpp and then src\ext\BalExtension\wixstdba for the pre-req BA.