Deploying Windows Applications with Visual Studio.NET, Part 2
Build the Installer Package
Now that you have configured all the editors and set all the options, you can build the installer project. Select Build | Build Solution from the menu to create the MSI installer package. Once the installer is successfully built, you will see the files shown in Figure 6 in the Release directory of your installer project directory.
Figure 6: Files in the Release Directory of Your Installer Project Directory
The Readme.txt file appears as a single file because you set the PackageAs property to vsdpaLoose when you configured the File System Editor. In addition, you see two variants of Windows Installers: one version (InstMsiA.exe) for Windows 98/ME; another version (InstMsiW.exe) for Windows NT/2000/XP.
Install the FormattingApplication
To install the FormattingApplication, you can use either of the following options:
- Double-click on either the FormattingApplicationSetup.msi file or the Setup.exe file from Windows Explorer.
- Right-click on the FormattingApplication.msi file and then choose Install from the context menu.
Now, follow the steps for installing the FormattingApplication on the end user's computer. Start the installation by double-clicking the FormattingApplicationSetup.msi file from Windows Explorer. The following steps lead you through the installation:
- Splash screen—The first dialog, appears after a popup window that states Preparing to install; displays the bitmap you specified using the SplashBitmap property.
- Welcome dialog box—The next dialog; displays the developer.com logo because you set the BannerBitMap property to it.
- Read me dialog box—Displays the contents of the readme.rtf file that you specified using the ReadMeFile property; also displays the developer.com logo.
- License Agreement—Displays the contents of the license.rtf file that you specified using the LicenseFile property; also displays the developer.com logo. (The Next button in the dialog box is enabled only when the user selects the I Agree option, thereby making sure that the user agrees to the licensing terms and conditions.)
- Shortcut checkbox dialog box—Asks the user whether he or she wants a shortcut to the application to be installed in his or her desktop. (When the user checks the checkbox, he or she sets the condition SHORTCUTDEMO to true, thereby installing a shortcut to the application on the desktop.)
- Installation folder—Displays the path to the installation folder where the application will be installed; also provides the user with an option to change the installation folder, if required. (You also can specify whether you want to install the application only for yourself or make it available to everyone who will be using that computer. You can also find out how much disk space is required to install the application by clicking the Disk Cost button.)
- Disk cost—Helps identify the suitable drive (that has enough space) in which the application can be installed; displays the amount of disk space required for installing the application, as well as the free space available in each drive.
- Confirm Installation—Allows you to provide the final confirmation before the application install can proceed. (Clicking the Next button on this dialog box installs the application on the user's computer. Its progress is displayed in the Progress dialog box as a progress bar.)
- Finished Installation—Once the installation is complete, you see the Installation Complete dialog box, which confirms that the installation has successfully completed.
Uninstalling and Repairing the Application
Now that you have successfully installed the application, consider the uninstall process, which is very simple. Just open up the Add/Remove Programs window on the end user's computer by going to Start | Control Panel, and then double-click the Add/Remove Programs icon. Now, all you have to do is click the Remove button and a confirmation dialog box (asking you to confirm the uninstall process) appears. If you click Yes, the uninstall process begins and the application is completely removed. You also can uninstall the application by right-clicking on the FormattingApplicationSetup.msi from Windows Explorer and selecting Uninstall from the context menu. When you right-click on the FormattingApplicationSetup.msi file, you also see the Repair option in the context menu, which is very useful when you accidentally delete any of the application-related files from the machine and need to bring the application back to its original state.
What You've Learned
In this article, you learned the different aspects of deploying a Windows forms application. The discussion began with an introduction to deployment and its fundamentals and then went on to cover the different types of deployments supported by .NET. Specifically, the article covered XCOPY deployment and Windows Installer-based deployment.
After considering both types, you learned why the features that Windows Installer offers make it the preferred choice. Then you walked through a complete Windows forms application deployment using the Visual Studio .NET installer, including customization with various editors, installation on an end user's computer, and the uninstall process.
Download the CodeTo download the accompanying source code for this article, click here.
About the Author
Thiru Thangarathinam has six years of experience in architecting, designing, developing, and implementing applications using object-oriented application development methodologies. He also possesses a thorough understanding of the software life cycle (design, development, and testing). He holds several certifications, including MCAD for .NET, MCSD, and MCP. Thiru is an expert with ASP.NET, .NET Framework, Visual C# .NET, Visual Basic .NET, ADO.NET, XML Web services, and .NET Remoting. Thiru also has authored numerous books and articles. Contact him at email@example.com.
Page 4 of 4