MSI-Wix combobox

Posted on 2014-08-31
Last Modified: 2014-09-15
Hi Experts,
I have a custom action that shows list of application pools in the system and want to bind these values into combobox which is inside customdlg.wxs and while executing MSI setup I should get a combobox that show list of app pools.

Please guide me how to bind custom action values to combobox in WIX?
custom action
//List all App pools    
public static ActionResult GetAppPools(Session session)
    using (ServerManager iisMgr=new ServerManager())
        System.Collections.IEnumerator ie = iisMgr.ApplicationPools.GetEnumerator();
        List<string> apppools = new List<string>();

        while (ie.MoveNext())
    return ActionResult.Success;

Open in new window


<Control Id="ApplicationPoolLabel" Type="Text" Y="94" X="11" Width="349"  Height="16" TabSkip="no" Text="Application Pool: " />
<Control Id="ApplicationPoolCombo" Type="ComboBox" Y="94" X="100" Width="150" Height="16" ToolTip="Application Pool" Property="APP_POOL" Text="{80}">
    <ComboBox Property="APP_POOL">
        <ListItem Text="[APP_POOL]" Value="[APP_POOL]" />

Open in new window

Question by:ksd123
    LVL 40

    Accepted Solution

    Your custom action needs to populate table "combobox". Here's an example.

    Author Comment

    Thank you.I just followed the above example and here is the updated code for filling app pools in the combobox.Please correct me if I miss anything.

            public static ActionResult FillApplicationPools(Session session)
                if (null == session)
                    throw new ArgumentNullException("session");
                // Debugger.Launch();
                View iview = session.Database.OpenView("SELECT * FROM ComboBox");
                int lIndex = 1;
                DirectoryEntries appPools = new DirectoryEntry("IIS://localhost/W3SVC/AppPools").Children;
                foreach (DirectoryEntry appPool in appPools)
                    string applicationPoolName = appPool.Name;
                    Record record = session.Database.CreateRecord(4);
                    record.SetString(1, "APP_POOL");
                    record.SetInteger(2, lIndex);
                    record.SetString(3, applicationPoolName);
                    record.SetString(4, applicationPoolName);
                    iview.Modify(ViewModifyMode.InsertTemporary, record);
                return ActionResult.Success;

    Open in new window

    I have a question in the above stackflow example we have following code and did not understand why I need this and have  ignored while filling app pools in the combobox. Can you comment on this?

            ActionResult result;
            DataTable dt = SmoApplication.EnumAvailableSqlServers(false);
            DataRow[] rows = dt.Select(string.Empty, "IsLocal desc, Name asc");
            result = EnumSqlServersIntoComboBox(session, rows);
             return result;

    Open in new window

    LVL 40

    Expert Comment

    by:Vadim Rapp
    Because in their example they populated combobox with the names of available sql servers.

    Author Closing Comment

    Thank you

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Among others, I monitor the Windows Installer zone and Installer zone. I find that many of the questions could be answered much more quickly if a Windows Installer verbose log were submitted with the question.   However, I do not always have t…
    More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now