Changing icon in top left corner of forms

Jun 20, 2016 at 9:17 PM

I have used managed ui while creating the installer. i can see the icon i m trying to put on top left corner in code but once i compile and run the msi icon changes in dialogs.

Template i m using is "Wixsharp Managed setup- custom UI".
Thnx & Regards
Jun 21, 2016 at 3:26 AM
You can do this by accessing the shell form when UI is loaded. Changing the icon is a typical WinForm task and a simple way to accomplish it is to embed your icon in the assembly resources and extract it at runtime. You can also embed it into msi if you wish:
var project = new ManagedProject("ManagedSetup",
                    new Binary(new Id("appIcon"), "<path to your icon>"),
project.UILoaded += UILoaded;    
static void UILoaded(SetupEventArgs e)
    var data = e.Session.GetEmbeddedData("appIcon");
    using (var stream = new System.IO.MemoryStream(data))
        (e.ManagedUIShell as Form).Icon = new Icon(stream);
Marked as answer by Nisha16 on 6/20/2016 at 10:01 PM
Jun 21, 2016 at 6:01 AM
Thnx !!
Jun 23, 2016 at 8:37 AM
Edited Jun 23, 2016 at 8:38 AM
The latest release v1.0.39.0 contains a new ManagedUI attribute that allows setting the UI icon directly:
project.ManagedUI.Icon = "app.ico";