Visual Studio的安装和部署:是否创建具有可选组件的程序包? [英] Visual Studio setup and deployment: create package with optional components?

查看:76
本文介绍了Visual Studio的安装和部署:是否创建具有可选组件的程序包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,假设我的应用程序支持Epson打印机和Canon打印机.

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

我想在安装过程中有一个选项,也许是单选按钮,或者更好的是复选框(有一个选项可以选择两者),上面写着安装Epson驱动程序"和安装佳能驱动程序".

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

然后,根据用户选择,安装程序包将仅安装Epson驱动程序,或仅安装Canon驱动程序,或同时安装两者.

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?

推荐答案

好像无法通过VS安装和部署完成我需要的操作,因为我正在尝试从msi运行msi,这是不允许的.因此,作为一种解决方法,我不得不创建一个带有一些复选框和类似功能的小型包装" Windows Forms应用程序

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");
    }

现在要使该应用程序具有灵活性,例如从XML文件中读取设置文件位置等,但这不在问题范围内...

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

这篇关于Visual Studio的安装和部署:是否创建具有可选组件的程序包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆