Madhukar Krishna

Madhukar Krishna

  • 685
  • 1.4k
  • 294.2k

Setup and Deployment Project with username and Password

Jan 25 2015 3:11 PM

I am trying to create a username and Password for Setup Installation for a simple project. It is not working.

I have created a simple Windows Forms Project. Then I have added Setup and Deployment Project to the solution. In the File System of the Setup project I have added the necessary primary output and shortcuts. The setup project works. Now in the Main project I have added an Installer class. I have overridden the install method. Here is the code.

Public  override void Install(IDictionary stateSaver)

        {

           

           

            base.Install(stateSaver);

 

 

            // In order to get the value from the textBox named 'EDITA1' I needed to add the line:

            // '/PathValue = [EDITA1]' to the CustomActionData property of the CustomAction We added.

            string User1 = Context.Parameters["UserName"];

            string Pass1 = Context.Parameters["Pass"];

            if (User1 == "Madhu" && Pass1="123")

            {

                Install(stateSaver);

            }

            else

            {

                Rollback(stateSaver);

            }

        }

 

Now in the Custom Action of the setup project I have added the main project and in the properties of this custom action I have added Arguments EDITA1 EDITA2

and in Custom Action Data section I have added /UserName=[EDITA1]/Pass=EDITA2. Now in the User Interface I have added a new TextBox(A) with EDITA1 EDITA2 visible and the rest invisible. Now the problem is when I run the setup wizard to install, It asks for the username and password. But continues to install even if I have provided them wrong. I am very much looking for a correct guidance here. Please Help!!!