Reading Properties Passed to the .NET Installer Class

InstallShield 2015

This is an example of a .NET class that implements the installer class and demonstrates how to read properties that are passed to the installer class from the installation.

using System;

using System.Configuration.Install;

using System.Windows.Forms;

using System.Collections;

 

namespace MyInstall

{

    ///

    /// Summary description for Class1.

    ///

    [System.ComponentModel.RunInstallerAttribute(true)]

    public class MyInstallClass : Installer

    {

        public MyInstallClass()

        {

        }

        public override void Install(IDictionary stateSaver)

        {

 

            base.Install(stateSaver);

            foreach(string strKey in Context.Parameters.Keys)

            {

                MessageBox.Show(strKey + " is " + Context.Parameters[strKey]);

            }

        }

 

        public override void Commit(IDictionary stateSaver)

        {

            base.Commit(stateSaver);

            foreach(string strKey in Context.Parameters.Keys)

            {

                MessageBox.Show(strKey + " is " + Context.Parameters[strKey]);

            }

        }

 

        public override void Uninstall(IDictionary stateSaver)

        {

            base.Uninstall(stateSaver);

            foreach(string strKey in Context.Parameters.Keys)

            {

                MessageBox.Show(strKey + " is " + Context.Parameters[strKey]);

            }

        }

 

        public override void Rollback(IDictionary stateSaver)

        {

            base.Rollback(stateSaver);

            foreach(string strKey in Context.Parameters.Keys)

            {

                MessageBox.Show(strKey + " is " + Context.Parameters[strKey]);

            }

        }

    };

}

See Also