|< Day Day Up >|| |
Download Tracker doesn’t have any especially demanding setup requirements, so I’m going to use VS .NET to build a setup program for it. In this section, I’ll work through the process to give you an idea of what’s involved.
Developers take a wide range of attitudes toward licensing code within their software products. Some depend on the honor system to make sure that people don’t install illegal copies. Others require you to enter a serial number, while others might require online product activation before you can use the application.
For some reason, licensing support isn’t built into most installation creators. Instead, you’ll need to build your own licensing piece, or buy a solution. Given the complexity of building a strong license (one that’s hard for hackers to get around), I recommend buying a solution if you need licensing support in your products. Here are some of the available solutions for .NET products:
Aspose.License (www.aspose.com/Products/Aspose.License/; free)
Desaware Licensing system (www.desaware.com/DlsL2.htm; starting at $1495)
XHEO|Licensing (www.xheo.com/products/licensing/default.aspx; starting at $259.99)
The first step in the process is to add a new Setup and Deployment project to the overall solution file. I chose to use the Setup Wizard, and called the new project DownloadTrackerSetup. After an introductory screen, the Setup Wizard offers four choices, as shown in Figure 15.3:
Windows application setup
Web application setup (this is appropriate for ASP.NET applications)
Merge Module (this is appropriate for libraries that will be included in other products)
Downloadable CAB file (this is appropriate for controls downloaded to a web browser)
Figure 15.3: Choosing a project type
For this project, I chose to create a Windows application setup and clicked Next. The wizard next presents a list of components that it can incorporate into the setup automatically. This includes the outputs, resources, documentation files, debug symbols, content files, and source files from every project in the solution. For Download Tracker, I want to install the primary outputs (that is, the DLL and EXE files) for each of the nontest projects.
The fourth step of the Setup Wizard lets you add additional files to the setup. This is where you’d put in help files, license files, and anything else that you want to install with your product. For Download Tracker, this includes the Microsoft Access database. The last screen of the wizard just confirms the choices you made earlier; clicking Finish at this point creates the project and opens it in VS .NET.
The new project opens displaying the File System Editor. This is one of the six dedicated editors that allow you to modify a setup project. Toolbar buttons at the top of the Solution Explorer window let you switch between them:
File System Editor Allows you to add files and folders to the installation, and specify where they should be installed on the user’s system. You can also install shortcuts by right-clicking on a file and selecting Create Shortcut. The File System Editor knows how to deal with many special folders on the target system; right-click on the root node and select Add Special Folder to see the list.
Registry Editor Allows you to add Registry keys to the installation.
File Types Editor Allows you to add file associations (for example, Microsoft Word is generally associated with the .doc file extension) and specify the actions that can be performed on those files.
User Interface Editor Allows you to adjust the dialog boxes that will be displayed by the setup program. Figure 15.4 shows the list of dialog boxes that you can add. VS .NET provides you with the ability to add limited customization to these dialog boxes by setting properties, but there’s no general dialog-box editor available.
Figure 15.4: Dialog boxes for setup projects
Custom Actions Editor Allows you to add arbitrary pieces of .NET code to your setup, to be executed on install or uninstall.
Launch Conditions Editor Allows you to specify conditions that must be satisfied before your application can be installed. For example, you can specify that the .NET Framework must already be installed, or that a particular file or Registry key must be present.
In addition to working in the specific editors, you’ll need to customize the properties of the setup project itself. Figure 15.5 shows the Properties window for the DownloadTrackerSetup project.
Figure 15.5: Properties for a setup project
When you’re done making choices in the setup editors, you can create the setup program simply by compiling the solution. After building the installer, you can test it by right-clicking on the setup project in Solution Explorer and selecting Install. By default, the installer will contain three panels: a welcome panel, a second panel that lets you select the location where the product will be installed, and a confirmation panel. Figure 15.6 shows the start of the Download Tracker setup program.
Figure 15.6: The completed installer
|< Day Day Up >|| |