Get some parameter from user when installing C # application

I have an application for creating a C # form, and I create a “customization” for it using visual studio 2010

my application needs some parameters like username, password, ip and ...

I want to get these values ​​from the user before the installation is complete and save it in a file that will be used by my application. but how?

+3
source share
2 answers

This answer assumes that you are using the installation project in Visual Studio. If you are not editing your question, and we can take another look.

To collect user input, you need to enter a new dialog to the installer.

, :

  • Solution Explorer " "
  • (, "" ) " "
  • . , .

- , . .


, , .

(, ).

, , :

public override void Install(System.Collections.IDictionary stateSaver)
{
    string myPassedInValue=this.Context.Parameters["TEST"];
    //Do what you want with that value - such as storing it as you wanted.
}

10000 - , . - , , . - , , .

+4

VS explorer

yoursetupUSerInterface

TextBox

enter image description here

Custom Class Install class

Install.cs

public override void Install(IDictionary stateSaver)
    {
                base.Install(stateSaver);
                string targetDirectory = Context.Parameters["Username"];
                string servername = Context.Parameters["password"];
    }
+1

All Articles