-
Notifications
You must be signed in to change notification settings - Fork 1
Bundle Source
Bundle.wxs (.NET Framework) || (.NET Core)
At the very top, you'll find a namespace reference for the WiX bootstrapper application layer.
xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"
That's followed by definitions for a few variables that will be referenced in the rest of the source.
There's a definition for the format of the file name for log files emitted when the bundle is run. I've placed the bundle's version in the file name to make it easier to tell which bundle generated which log during an update.
<Log Prefix =".\$(var.ProductName)_$(var.ProductVersion)" Extension="log" />
The Bundle
defines the structure of the bundle that will be built. The BootstrapperApplication
is declared inside the Bundle
.
We reference WixManagedBootstrapperApplicationHost
, which tells the WiX bundle that our BA is targeting .NET Framework.
<BootstrapperApplication bal:CommandLineVariables="caseInsensitive">
<bal:WixManagedBootstrapperApplicationHost />
...
</BootstrapperApplication>
After this, we can add files to the bundle's payload that will be included in addition to the files referenced in the Chain
. Since we've referenced the managed app host, we need to include at least one DLL where our BA can be found. In our case, this is boostrapper.dll. Since many files can be included as payload, we also need to let WiX know which file contains a factory that can construct our BA. That's done by including the BAFactoryAssembly
attribute. The factory will be covered when we look at the Bootstrapper project.
<Payload SourceFile="$(var.Bootstrapper.TargetFileName)" bal:BAFactoryAssembly="yes"/>
But our DLL has some dependencies, so we need to make sure they are packed into the bundle as well. That's done by adding as many Payload
s you need.
<Payload SourceFile="$(var.Bootstrapper.TargetDir)mbanative.dll"/>
<Payload SourceFile="$(var.Bootstrapper.TargetDir)WixToolset.Mba.Core.dll"/>
<Payload SourceFile="$(var.Bootstrapper.TargetDir)WixToolset.Mba.Host.config"/>
We reference WixDotNetCoreBootstrapperApplicationHost
, which tells the WiX bundle that our BA is targeting .NET Core.
<BootstrapperApplication bal:CommandLineVariables="caseInsensitive">
<bal:WixDotNetCoreBootstrapperApplicationHost SelfContainedDeployment="yes" />
...
</BootstrapperApplication>
After this, we add the BA's files to the bundle's payload. In Bundle.wixproj, we used Heat to harvest the Bootstrapper assembly and all its dependencies. We'll use a PayloadGroupRef
to reference the PayloadGroup
that Heat produced.
<PayloadGroupRef Id="BA.publish" />
I'm going to gloss over the Chain
because the WiX 3 help and tutorials cover the topic well. I will add that with v4, you need to include the PrereqPackage
attribute to make sure the packages you deploy are included in the plan.
← Previous: Solution Overview || Next: Bootstrapper Overview →