Thanks Daniel, this is precisely what I needed! On Fri, Oct 19, 2012 at 9:32 AM, Daniel Bruce <daniel.br...@prediktor.no>wrote:
> To resolve Microsoft.Tools.WindowsInstallerXml.Bootstrapper, you need to > add a reference to BootstrapperCore, which in my installation was located > under C:\Program Files (x86)\WiX Toolset v3.7\SDK\BootstrapperCore.dll. You > should be able to find yours in a similar location. > > You are correct that there is little information about how to get started > with Burn, and the little information there is to find is scattered around > the net and pretty terse, so I'll give you enough to get started, then you > should be able to look at the source code for the WiX BA to continue (I > highly recommend having the source around to look at either way, because > there is really no other way to get information about most things). > > For my WPF-based bootstrapper interface, I started a regular WPF > application project and changed its output type to "class library". Then I > have a class that inherits from BootstrapperApplication looking something > like this: > > public class MyBA : BootstrapperApplication > { > static public Threading.Dispatcher Dispatcher { get; private set; } > static public View.InstallerWindow Window { get; private set; } > static public App TheApp { get; private set; } > > protected override void Run() > { > TheApp = new App(); > TheApp.InitializeComponent(); > // Send a reference to the Application to access things, if > necessary > TheApp.BA = this; > MyBA.Dispatcher = Threading.Dispatcher.CurrentDispatcher; > TheApp.Run(); > this.Engine.Quit(TheApp.ExitCode); > } > } > > And in my WPF Application class I have code like this to bring up a pretty > standard MVVM application window: > > public partial class App : Application > { > public View.InstallerWindow Window { get; private set; } > public > Microsoft.Tools.WindowsInstallerXml.Bootstrapper.BootstrapperApplication BA > { get; set; } > public int ExitCode > { > get > { > return state.InstallerResult; > } > } > > private InstallationState state; > > protected override void OnStartup(StartupEventArgs e) > { > base.OnStartup(e); > > InstallationState state = new InstallationState(BA, ...); > this.state = state; > InstallerViewModel vm = new InstallerViewModel(state, ..., > Threading.Dispatcher.CurrentDispatcher); > var Window = new View.InstallerWindow(vm); > state.ParentHwnd = new WindowInteropHelper(Window).Handle; > Window.Show(); > state.Initialize(); > } > } > > You also need to create a config file so the Burn managed bootstrapper > host can find your application, which should be named something like > YourAssemblyName.BootstrapperCore.config and look something like this, > replacing "YourAssemblyName" with your own assembly's name: > > <?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" /> > </startup> > <wix.bootstrapper> > <host assemblyName="YourAssemblyName"> > <supportedFramework version="v4\Full" /> > <supportedFramework version="v4\Client" /> > </host> > </wix.bootstrapper> > </configuration> > > Then, finally, in your bundle.wxs file add a reference to your assembly > and put in this snippet to refer to your bootstrapper application properly, > again replacing as necessary: > > <BootstrapperApplicationRef Id='ManagedBootstrapperApplicationHost'> > <Payload Name='BootstrapperCore.config' > SourceFile='$(var.YourAssemblyName.TargetDir)\YourAssemblyName.BootstrapperCore.config' > /> > <Payload SourceFile='$(var.YourAssemblyName.TargetPath)' /> > </BootstrapperApplicationRef> > > Now if you want to be able to run this with F5 from Visual Studio, you > should build your bundle once first, then set your WPF assembly as the > startup project, go into its project properties under Debug, set it to > Start external program and point it to the exe file from your bundle. This > is necessary because you can't set wixprojects as startup projects. If you > want to debug the bootstrapper application and set breakpoints and whatnot, > you need to attach to the process manually (ctrl+alt+p in my VS2010) after > pressing F5, because of how Burn works. To facilitate this, I created a > function like this that I call at the very beginning of my > BootstrapperApplication.Run method: > > [Conditional("DEBUG")] > private void ShowDebugMessageBox() > { > MessageBox.Show("If you want to debug the Bootstrapper Application, > you should attach the debugger to the .NET process now and click the > button."); > } > > Sorry if any of this got horribly mangled in transport, but hopefully you > can pick out what to do and this gives you something to work from. > > Regards, > Daniel E. Bruce > > > -----Original Message----- > > From: Hans ter Horst [mailto:hoshis...@gmail.com] > > Sent: 19. oktober 2012 09:32 > > To: wix-users@lists.sourceforge.net > > Subject: Re: [WiX-users] Getting started writing a custom Bootstrapper > > interface > > > > Hello, could you please help me get started building my own bootstrappe > > DLL? It is a Wix bootstrapper newbie question, but I guess there are > > plenty of us around :-) > > > > Thanks, > > > > Hans > > > > On Thu, Oct 18, 2012 at 5:43 PM, Hans ter Horst <hoshis...@gmail.com> > > wrote: > > > > > Hello, I would like to add an interface to the Wix bootstrapper and > > > started Googling around but found few examples to get started. > > > > > > I have the following basic questions: > > > > > > - What project template would be best to use in VS 2010 or VS 2012? > I > > > am thinking of a WPF based interface, should I select one of the WPF > > > library project templates? Or should I pick the plain vanilla DLL > > template > > > and build on that? > > > - I started playing around a little already with a simple project > and > > > the line of code* **using > > > Microsoft.Tools.WindowsInstallerXml.Bootstrapper;* ran into a > > missing > > > reference, I couldn't find any reference that would resolve this, > what > > > assembly do I add? > > > > > > Thanks, > > > > > > Hans. > > > -- > > > http://monochrome.me.uk/blog/ > > > > > > > > > > > > -- > > http://monochrome.me.uk/blog/ > > > ------------------------------------------------------------------------------ > > Everyone hates slow websites. So do we. > > Make your web apps faster with AppDynamics Download AppDynamics > > Lite for free today: > > http://p.sf.net/sfu/appdyn_sfd2d_oct > > _______________________________________________ > > WiX-users mailing list > > WiX-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wix-users > > > > _______________________________________________________ > > _______________ > > This email has been scanned by the Symantec Email Security.cloud > > service. > > For more information please visit http://www.symanteccloud.com > > _______________________________________________________ > > _______________ > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > -- http://monochrome.me.uk/blog/ ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users