Hello Igor,

is there any chance that you could provide us the source code?

Bets regards,

Christian


-----Ursprüngliche Nachricht-----
Von: Igor Brejc [mailto:igor.br...@gmail.com] 
Gesendet: Samstag, 20. Oktober 2012 20:04
An: General discussion for Windows Installer XML toolset.
Betreff: Re: [WiX-users] Getting started writing a custom Bootstrapper interface

Hi,

Some more pointers from me. I've implemented a custom managed bootstrapper 
using WinForms. The GUI actually looks pretty much the same as the standard MSI 
setup wizard, but implemented with custom C# code using MVP
(model-view-presenter) pattern. This enables me to unit-test the wizard without 
actually running the installation.

I've also "hidden" the WiX bootstrapper engine behind an adapter interface (I 
called it IInstallEngine). This way I can run the wizard as a "normal"
Windows Forms application and click through it (again, without the need to run 
the actual Windows installation), since in that mode the wizard uses a mocked 
implementation of IInstallEngine. I just simply added the static Main method 
which has the similar logic to the Run().

(Note to Rob: perhaps it would be a good idea to change the design of the 
managed bootstrapper so that it works with interfaces instead of concrete 
implementations, this would be really helpful for unit testing and simulation).

The wizard has one added feature: a debug window which can be turned on through 
the command line and displays all the install log messages directly in the 
setup wizard.

The documentation for the managed BS is pretty scarce, so I had to look into 
WiX's source code and do a lot of trials and errors to get to this point (and I 
still have some issues to work through).

Best regards,
Igor Brejc

On Fri, Oct 19, 2012 at 10:39 AM, Hans ter Horst <hoshis...@gmail.com>wrote:

> 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.BootstrapperApplica
> > tion
> 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.BootstrapperSec
> tionGroup,
> > 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
>
------------------------------------------------------------------------------
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



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

Reply via email to