locked
How to give the user an option to install a third party software in the installation project! RRS feed

  • Question

  • Dear All,

     

    I am creating a VS.NET installer project (msi) in which i have to give the user option to install a third party software.

    The setup should determine the previous installation of the specific third party software and give user option to install or not depending upon his/her choice. How do i accomplish it.

     

    Thanks in advance.

     

    Dileep

    Friday, January 4, 2008 2:25 PM

Answers

  • Hi, DileepKumar,

     

    Based on my understanding, you want to give the user a choice to install some third party software if he/she has not installed it before, don't you?

     

    I think you can do this by Custom Actions and Launch Conditions.

    But first of all, you should find out what will change after you install this software.

    Will it add some file to some specific foder in your system? Will it change your registry? Will it add Component to your system.

    Because we will need to do some check first with Launch Conditions.

    http://msdn2.microsoft.com/en-us/library/5ecafwe3.aspx

     

    Let's do a registry check as an example.

    Suppose the software will create a key "test" in "HKEY_LOCAL_MACHINE/Software".

    1) We should create a "Search For Registry" in Launch Conditions Window, and set the properties as the following.

     

    2) Please add  a installer into your project, and you can write some codes to show a Form for the users to choose if to install the software. (You should create this form which can provide installation options and start the exe process)

        For example   

    Code Block

            public override void Install(IDictionary stateSaver)

            {

                if (Context.Parameters["reg"] == "")

                {

                    //If the reg value is not found, show your form here.

                }

                else

                {

                    //If the reg value is found, then do nothing...

                }

                base.Install(stateSaver);

            }

     

     

    3) Add the Custom Action to your Setup Project through Custom Actions Window and set its CustomActionData like this.

    Code Block

        /reg="[REGSEARCH]\"

     

    4) OK, build and install your project, if the software is not installed, a form will show up to ask if the user wants to install it or not.

     

    More info about Custom Actions.

    http://msdn2.microsoft.com/en-us/library/d9k65z2d(VS.80).aspx

     

    Hope this helps,

    Regards

     

    Thursday, January 10, 2008 2:55 AM
  • Hi, Dileep Kumar,

     

    I think you can actually wait for the process to exit in your Custom Action.

    And the Process.WaitForExit Method can help you to do this job.

    http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.waitforexit.aspx

     

    If the user wants to install the software, the setup project should wait until the process is finished.

    Then it can copy and register the dlls without any problem.

     

    Hope this helps,

    Regards

    Friday, January 11, 2008 1:38 AM

All replies

  • You'll need to be explicit about the delivery mechanism for this 3rd party setup. Is it a setup executable? Is it an MSI-based setup?

     

    Generally speaking it's difficult to do complicated detection in the UI part of the install because Visual Studio setups don't let you hook code into the UI sequence of the install.

     

    Friday, January 4, 2008 9:32 PM

  • Thanks Phil,

    Actually the third party setup is an exe. I have to find whether it is installed on the system during the installation process, and give the user appropriate message or gui to optionally select it for installation.

    Warm Regards,
    Dileep
    Saturday, January 5, 2008 11:47 AM

  • If possible, can you please suggest how i should proceed. Or some alternate mechanism.

    Thanks in advance,
    Dileep
    Saturday, January 5, 2008 11:50 AM
  • Hi, DileepKumar,

     

    Based on my understanding, you want to give the user a choice to install some third party software if he/she has not installed it before, don't you?

     

    I think you can do this by Custom Actions and Launch Conditions.

    But first of all, you should find out what will change after you install this software.

    Will it add some file to some specific foder in your system? Will it change your registry? Will it add Component to your system.

    Because we will need to do some check first with Launch Conditions.

    http://msdn2.microsoft.com/en-us/library/5ecafwe3.aspx

     

    Let's do a registry check as an example.

    Suppose the software will create a key "test" in "HKEY_LOCAL_MACHINE/Software".

    1) We should create a "Search For Registry" in Launch Conditions Window, and set the properties as the following.

     

    2) Please add  a installer into your project, and you can write some codes to show a Form for the users to choose if to install the software. (You should create this form which can provide installation options and start the exe process)

        For example   

    Code Block

            public override void Install(IDictionary stateSaver)

            {

                if (Context.Parameters["reg"] == "")

                {

                    //If the reg value is not found, show your form here.

                }

                else

                {

                    //If the reg value is found, then do nothing...

                }

                base.Install(stateSaver);

            }

     

     

    3) Add the Custom Action to your Setup Project through Custom Actions Window and set its CustomActionData like this.

    Code Block

        /reg="[REGSEARCH]\"

     

    4) OK, build and install your project, if the software is not installed, a form will show up to ask if the user wants to install it or not.

     

    More info about Custom Actions.

    http://msdn2.microsoft.com/en-us/library/d9k65z2d(VS.80).aspx

     

    Hope this helps,

    Regards

     

    Thursday, January 10, 2008 2:55 AM
  •  

    Hi Yu Guo,

     

    Thanks for answering to the post, I tried to follow the approach as suggested by you but it had few limitations.

    Let me clarify you the complete details of the problem:

     

    I have to run the exe which restarts the system when the setup is completed. also I have to copy two dlls extracted from the same exe in a folder and register them using regsvr32. This registration can only happen when the exe setup is complete.

    After this complete process my setup should be finished.

     

    1.) I created the setup project and a custom action (say CustomAct1), i searched for the registry entries in this custom action and gave user a form for option to install the exe or not if registry entry is not present.

     

    2.) If the user selects to install the exe it installs by running a process in the CustomAct1. The exe setup completes and the system is restarted. now how do i go to the state of installation and proceed with the registering of the dlls.

     

    Thanks in Advance,

    Dileep Kumar

     

     

    Thursday, January 10, 2008 3:01 PM
  • Hi, Dileep Kumar,

     

    I think you can actually wait for the process to exit in your Custom Action.

    And the Process.WaitForExit Method can help you to do this job.

    http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.waitforexit.aspx

     

    If the user wants to install the software, the setup project should wait until the process is finished.

    Then it can copy and register the dlls without any problem.

     

    Hope this helps,

    Regards

    Friday, January 11, 2008 1:38 AM