| Creating A Deployment Program Visual Studio .NET provides a rather easy-to-use and powerful capability to create deployment projects. Using VS .NET, we can build any of the four deployment projects below. - Setup Project. A Windows application setup program
- Web Setup Project. A Web application setup program
- Merge Module Project. For shared components
- Cab Project. Cabinet files
Also, a deployment project can be created using the Setup Wizard, which is the easiest and, in most cases, could be the best method. Based on the type of project, the complexity of the software, and the distribution method, we can select any of the four methods above. Our project is a Windows application; therefore, we are going to expose the Setup Project. However, all of the deployment types are quite powerful and need to be studied thoroughly. To create a setup project using VS .NET, follow the steps below: 1. Right click the Solution; on the Solution Explorer then go to Add --> New Project.... Enter a name for your project (see Figure 3). The name of the setup project determines the name of the .msi file which will automatically be generated by VS .NET. Figure 3: Adding a setup project to a solution. 2. Add items to the project. Right click on the Setup Project then go to Add --> Project Output... as shown in Figure 4. Figure 4: Add Project Output. The Add Project Output Group dialog box appears. Select the Primary output and any other item from the list that applies to your project then click OK. Figure 5: Add Project Output Group dialog box 3. Edit the setup project properties. Click on the setup project to see the properties dialog box. Here, I have edited the Author, Description, Keywords, Manufacturer, ManufacturerUrl, ProductName, and Title properties. Figure 6: The properties of the setup project. After the software is installed, some of the properties will appear in the Support Information dialog box for the installed product. This can be viewed by going to Control Panel's Add or Remove Programs window. 4. Add a shortcut to the start menu. Click the setup project go to View --> File Systems. The items on the left side represent some of the special folders on the end user's machine. To add a shortcut directly to the Programs folder of the Start Menu, select the item labeled User's Program Menu. In the right pane, right-click and choose Create New Shortcut from the pop-up menu, as shown in Figure 7. Figure 7: Adding a shortcut to the User's Programs Menu. In the Select Item in Project dialog box that appears, select Application Folder in the top drop-down list and then choose Primary Output from setup project, and click OK. Then change the shortcut name to the name of your application. On Windows XP, this name will appear under Start --> All Programs --> You can also add a shortcut to the desktop using the same method except that this time the special folder on the Figure 7 will be the User's Desktop folder.
At this time build the setup project by right clicking on the project and click Build. User Interface Now it is time to examine the User Interface of our setup project. To do so, right-click on the Setup project in the Solution Explorer and choose View --> User Interface from the pop-up menu. The User Interface Editor will appear on a new tab in the Forms Designer area, as shown in the figure below. Figure 8: The User Interface Editor. By default, VS .NET constructs a small number of dialog boxes which are combined under two main sections: Install and Administrative Install. Each one of these sections includes three sub-sections: Start, Progress and End. Also, each sub-section includes one or more dialog boxes. During the install process, the setup program displays these dialog boxes in order. If no additional dialog boxes are included, the default dialog boxes are for allowing the user to select folders, specify options, and show the progress of the installation and so on. The properties of these boxes can be changed via property window. Also, if we want Administrators to have setup features that are different from other users, we may have different properties for the dialog boxes that are under the Administrative Install section. We can also move up and down and delete any of the dialog boxes by using Right click --> Move Up, Move Down, Delete respectively. More important, we can add other dialog boxes from a fairly long list of built-in dialog boxes. To do so, right-click on one of the sub-sections (Start, Progress, or End) shown in the User Interface Editor and select the Add Dialog command from the pop-up menu. The Add Dialog Wizard will appear, allowing us to choose the type of dialog box to add, as shown in Figure 9. Figure 9: The Add Dialog Box. Here, we will not examine all of the built-in windows shown in Figure 9; we will rather examine only one of them: TextBoxes (A). The notion of adding any of these boxes is similar; however, the properties are different. To learn more about the other dialog boxes, refer to MSDN Web site. All of the Textbox dialog boxes (Textboxes (A), Textboxes (B), and Textboxes (C)) are identical. These boxes are utilized to prompt the user for additional information we need in our custom setup program. They all have four edit boxes, but we can show / hide anyone of them by setting its EditNVisible property to true or false. N specifies the index (number) of the textbox (i.e. for second textbox, N = 2). To achieve our objective, we need to add Textboxes (A) by right-clicking on Start section, then Add Dialog. Select Textboxes (A) then click OK. Right-click on Textboxes (A) --> Move Up to set the Textboxes (A) under Welcome dialog box, as shown in Figure 10. Figure 10: The User Interface including Textboxes (A). Now, we need to edit the properties of Textboxes (A). Figure 11 shows the properties used to configure the TextBoxes (A) dialog box. Figure 11: The properties used to configure the TextBoxes (A) dialog box. As shown in Figure 11, I will use only one textbox, namely the first one. I have hidden the other three by setting their EditNVisible property to False. To retrieve the data entered by the user, I'll need to reference the Edit1Property value (COMPANYNAME_A1) in the code. Thus far, we have provided a way for the user to input data, namely the name of their organization. We also provided a default name in case they don't care about entering their organization's name. We did this by setting Edit1Value property to Arslan Inc. Now, we are ready to obtain this data to perform what is called Custom Actions. << Abstract Custom Actions >> |