
Optional Deployment Capabilities
This step demonstrates optional deployment capabilities; it creates a shortcut to your application that will be placed on the desktop of a target computer during installation.
To create shortcuts for the Windows-based application
Select the My Notepad Installer project in Solution Explorer.
In the File System Editor, select the Primary output from My Notepad node.
On the Action menu, click Create Shortcut to Primary Output from My Notepad.
This will add a node called Shortcut to Primary output from My Notepad.
Rename the shortcut Shortcut to My Notepad.
Select Shortcut to My Notepad and drag it to the User's Desktop folder in the left pane.
Creating a File Association
This step adds a file association for My Notepad so that double-clicking .vbn files opens the My Notepad application.
To create file associations for the Windows-based application
Select the My Notepad Installer project in Solution Explorer. On the View menu, point to Editor, and then click File Types. The File Types Editor appears.
In the File Types Editor, select the File Types on Target Machine node. On the Action menu, click Add File Type.
A node named New Document Type #1 is added and opened for renaming.
Rename New Document Type #1 as Vbn.doc.
In the Properties window, set the Extensions property of the file type to vbn.
Select the Command property and click the ellipsis (...) button. In the Select Item in Project dialog box, navigate to the Application Folder, and select Primary output from My Notepad.
Click OK to close the dialog box.
Adding a Registry Entry
This step adds a registry key and value to the registry. You can reference this registry key from your application's code to retrieve user-specific information at run time.
To add a registry entry for the Windows-based application
Select the My Notepad Installer project in Solution Explorer. On the View menu, point to Editor, and click Registry. The Registry Editor appears.
In Registry Editor, select the HKEY_CURRENT_USER node and expand it, and then expand the Software node and select the [Manufacturer] node.
Note: |
|---|
The
[Manufacturer] node is enclosed in brackets to indicate that it is a property. It will be replaced by the value entered for the Manufacturer property for the deployment project.
|
On the Action menu, point to New, and then click Key.
Rename the key UserChoice and select it.
On the Action menu, point to New, and then click String Value.
Rename the string value TextColor.
In the Properties window, select the Value property and enter Black.
Adding a Custom Installation Dialog Box
This step adds and configures a custom user interface dialog box that will be displayed during installation.
To add a custom installation dialog box
Select the My Notepad Installer project in Solution Explorer. On the View menu, point to Editor, and click User Interface. The User Interface Editor appears.
In the User Interface Editor, select the Start node (under the Install node).
On the Action menu, click Add Dialog.
In the Add Dialog dialog box, select Checkboxes (A).
Click OK to close the dialog box.
Right-click the Checkboxes (A) dialog box and select Move Up two times to position it above the Installation Folder dialog box.
In the Properties window, set the BannerText property to Samples.
Set the BodyText property to the following:
The Install Samples check box controls whether the sample files are installed. If left unselected, the samples will not be installed.
Set the CheckBox1Label property to Install samples?
Set the properties Checkbox2Visible, Checkbox3Visible, and Checkbox4Visible to False. This will hide the additional check boxes.
Working with Samples
This step creates a Samples subfolder that will be installed beneath the Application folder.
To add a Samples folder
Select the My Notepad Installer project in Solution Explorer. On the View menu, point to Editor, and click File System. Select Application Folder if it is not already selected.
Right-click Application Folder, point to Add, and then click Folder.
Rename New Folder #1 as Samples.
This step creates two sample text files that will be installed if the user chooses the Install samples option in the custom dialog box.
To create sample files for the application
Using Notepad or another text editor, create a text file that contains the text This is rules.vbn. Save it as Rules.vbn.
Note: |
|---|
To prevent Notepad from automatically adding a .txt extension, select
All Files in the Files of type list.
|
Create another text file that contains the text This is memo.vbn. Save it as Memo.vbn.
This step adds the sample files to the Samples folder, and sets a condition that determines whether to install the files.
To add the samples to the installer
Select the My Notepad Installer project in Solution Explorer. On the View menu, point to Editor, point to File System, and select the Samples folder.
From the Action menu, point to Add, and then click File. Add the Rules.vbn and Memo.vbn files to the Samples folder.
Select the file Rules.vbn in the File System Editor.
In the Properties window, set the Condition property to CHECKBOXA1=1. When the installer is run, the file Rules.vbn will be installed only if the custom check box is selected.
Select the file Memo.vbn in the File System Editor.
In the Properties window, set the Condition property to CHECKBOXA1=1. When the installer is run, the file Memo.vbn will be installed only if the custom check box is selected.
Adding Launch Conditions
This step checks to see whether Internet Explorer 5.0 or a later version of Internet Explorer is installed on a target computer, and it stops installation if the file is not installed.
To add a launch condition to check the Internet Explorer version
Select the My Notepad Installer project in Solution Explorer. On the View menu, point to Editor, and then click Launch Conditions.
Note: |
|---|
This step is intended only to demonstrate the concept of launch conditions; the My Notepad application has no actual dependency on Internet Explorer.
|
In the Launch Conditions Editor, select the Requirements on Target Machine node.
On the Action menu, click Add File Launch Condition.
A Search for File1 node is added beneath the Search Target Machine node, and a Condition1 node is added beneath the Launch Conditions node.
Rename Search for File1 to Search for Internet Explorer.
In the Properties window, set the FileName property to Iexplore.exe, the Folder property to [ProgramFilesFolder], the Depth property to 2, and the MinVersion property to 5.00.
Select the Condition1 node.
Set the Message property to the following:
This program requires Microsoft Internet Explorer 5.0 or later. Please install Internet Explorer and rerun the Notepad installer.
Setting Properties for Prerequisite Components
This step sets a property to install the .NET Framework automatically if the correct version is not present on the target computer. Note that the .NET Framework 2.0 package will also install the Windows Installer 2.0 files.
When the prerequisites properties are set as follows, clicking setup.exe will automatically install the .NET Framework before it runs the .msi file. (This is set by default.) For more information about specifying prerequisites, see Prerequisites Dialog Box.
To set optional properties for the deployment project
Select the My Notepad Installer project in Solution Explorer. On the View menu, click Property Pages.
In the My Notepad Installer Property Pages dialog box, in Installation URL, specify the URL of a server or Web site from which the application and/or prerequisites will be installed. Click the Prerequisites button.
In the Prerequisites dialog box, under Choose which prerequisites to install, make sure that .NET Framework is selected. (It should be selected by default.) Under Specify the install location for prerequisites, accept the default setting.
On the Build menu, click Build My Notepad Installer.
Installing on Your Development Computer
This step will run the installer and install My Notepad on your development computer.
To install My Notepad on your development computer
Deploying to Another Computer
This step will run the installer and install My Notepad on another computer.
To deploy My Notepad to another computer
In Windows Explorer, navigate to your project directory and find the built installer. The default path will be \Documents and Settings\yourloginname\My Documents\Visual Studio 9.0\Projects\Solution Folder Name\My Notepad Installer\project configuration\My Notepad Installer.msi. (The default project configuration is either Debug or Release.)
Copy My Notepad Installer.msi, Setup.exe, and all other files and subdirectories in the directory to another computer.
Note: |
|---|
To install on a computer that is not on a network, copy the files to traditional media such as CD-ROM.
|
On the target computer, double-click Setup.exe to run the installer.
Note: |
|---|
You must have install permissions on the target computer in order to run the installer.
|
Testing
This step will test starting the application from a desktop shortcut and will also test uninstalling it.
To test the installation
Verify that the shortcut is installed on the desktop and that it correctly starts the My Notepad application.
Uninstall the application by using Add or Remove Programs in Control Panel. In Add or Remove Programs, select My Notepad, and then click the Remove button.
Note: |
|---|
To uninstall the application from your development computer, on the
Project menu, click Uninstall.
|
The icon should be removed from the desktop and the installed application files and folders should be deleted from your computer.