I have a C# win form application and I build a "setup" for it by visual studio 2010
my application needs some parameters like username , pass, ip and ...
i want to get these values from user before setup complete and save it to a file to use by my application. but how?
This answer presumes that you are using the Setup Project in Visual Studio. If you aren't edit your question and we can take another look.
To gather user input you need to introduce a new dialog to the installer.
The following steps will bring you to the part of the installer project that will allow you to add new dialogs:
If you want something different you can also create a custom setup dialog. There is a nice code project post on doing this here.
Once you have this information you need to actually access it and use it during installation.
For this you need to add an installer class to your target project (the project you want to install).
In that installer class you can reference the text boxes you created using code like this:
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.
}
This answer is a little bit from 10000 feet - if I went into all the detail I'd end up writing a full article. If you have any sticking points, please ask. Also - have a look at this excellent article on the subject, it should get you most if not all of the way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With