Search code examples
.netvisual-studioinstallationwindows-installerproject

How to access information entered during setup? (VS2008 setup project)


I added a simple dialog window to the install's UI with textboxes. How do I find out what the user entered?

@Mitch Wheat: Thank you. I managed to solve the problem with your help. I needed to use the CustomActionData property of the Custom Action.

CustomActionData


Solution

  • When you say " added a simple dialog window to the install's UI with textboxes", I'm assuming you added a custom action and associated installer class.

    This snippet from this MSDN article, shows how:

    To create a custom action

    1. On the File menu, point to New, and then click Project.

    2. In the New Project dialog box, select Visual Basic in the Project Types pane, and then choose Class Library in the Templates pane. In the Name box, type PassData.

    The project is added to Solution Explorer.

    To create an installer class

    1. On the Project menu, click Add Class.

      In the Add New Item dialog box, choose Installer Class. Accept the default name.

    2. When the installer class appears on the design surface, right-click the design surface and click View Code to view the file contents in the code editor.

    3. Add the following procedure to override the Install procedure of the base class

      Public Overrides Sub Install(ByVal stateSaver As System.Collections.IDictionary)  
          MyBase.Install(stateSaver) 
          Dim myInput As String = Me.Context.Parameters.Item("Message") 
          If myInput Is Nothing Then 
              myInput = "There was no message specified"  
          End If 
          MsgBox(myInput) 
      End Sub