views:

1095

answers:

2

Let's say, for example, my application supports Epson printers and Canon printers.

I would like to have an option during installation, maybe radio buttons or, better, checkboxes (to have an option to choose both) that would say 'Install Epson drivers' and 'Install Canon drivers'.

Then, based on user selection, the setup package would install either only Epson drivers, or only Canon drivers, or both.

I guess what I want can also be described as having several prerequisites, but make them optional.

Any suggestions on where to begin?

+1  A: 

Looks like what I need cannot be done from VS Setup and Deployment, as I'm trying to run an msi from msi, which is not permitted. So as a workaround I had to create a small 'wrapper' Windows Forms application with a few checkboxes and a function like this

    private void InstallComponent(string filePath)
    {
        System.Diagnostics.Process installerProcess;

        installerProcess = System.Diagnostics.Process.Start(filePath);

        while (installerProcess.HasExited == false)
        {
            //indicate progress to user
            Application.DoEvents();
            System.Threading.Thread.Sleep(250);
        }
    }

and the 'Install' button that would do something along the lines of

    private void buttonInstall_Click(object sender, EventArgs e)
    {
        if (checkBoxCanonDrivers.Checked)
        {
            InstallComponent("CanonSetup.exe");
        }

        if (checkBoxEpsonDrivers.Checked)
        { 
            InstallComponent("EpsonSetup.exe");
        }

        // ............

        InstallComponent("MyMainApplicationSetup.exe");
    }

Now off to make this app flexible, like reading setup file locations from an XML file etc, but that is outside the scope of the question ...

Evgeny
A: 

I think you can do this in a Visual Studio deployment project, at least for simple cases (up to 4 checkboxes, I think, but I may be wrong). See this MSDN article: Checkboxes User Interface Dialog Box; it explains how to present a dialog box with checkboxes during installation and include or exclude files based on checkbox selection.

Alek Davis