2

I am using Visual Studio 2008 to create a setup project. I want to create a file which will contain values of the checkboxes which are selected by user during installation. How and where to write the code for the same? I am new to windows installer. Please provide me pointers for the same. Thank you in advance.

2
  • What do you mean by saving checkbox values to file ? you want to simply save selected values to a textfile ? Commented Oct 19, 2013 at 18:13
  • Yes, I simply want to save selected values to text file. Commented Oct 21, 2013 at 16:20

1 Answer 1

4

You can easily do it with installer class.

  1. First of add installer class to your setup project. Go to Add > Add New Item > Select Installer class

Installer Class

  1. Create a Window Form with radio button to get user input and logic to save selected values to a text file.

  2. Within installer class`s Install method open windows form to get the user input. So during the installation windows form will pop up where user can select the values.(Please not that this form will not open as a modal pop up)

Install()

 public override void Install(IDictionary stateSaver)
        {
            base.Install(stateSaver);

            Form1 form = new Form1();
            form.ShowDialog();
        }

Best approach

Best approach to get the user input during the installation is to create .wid file. See my post here.

Sign up to request clarification or add additional context in comments.

9 Comments

But I am not able to add InstallerClass to my setup project with the process you told me. I tried to google it but I don't have any option such "Add new item" which will add classes. Do I need to change any setting?
@AparnaSavant Just right click on the project and go to add item, its like how you add a class to a project.
Sorry, but after clicking right button on Project, I am able to see following options under "Add": "Project Output", "File", "Merge Module", "Assembly". There is no "Add Item" option which will eventually lead me to "Installer CLass". Please guide me what wrong I am doing.
Add a new C# class library project, Right click on it and select Add > New Item > Select Visual C# items > Installer Class.
+1 to AccessDenied. He's done a lot of work to help you out, Aparna. Upvoting his work or marking it as an answer is his only reward for helping.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.