20.2 Creating a Windows Setup Project Without Using the Wizard

 <  Day Day Up  >  

You want to create a setup project for a Windows application, and you cannot or don't want to use the wizard.


Technique

Create a setup project, but choose Setup Project (or whichever type of project you need) instead of Setup Wizard as the project type. VS.NET generates an install project that has all the features required of that type of install project, but that has no files in its list of files to install. For a Cab project, you need to add files by right-clicking on the project in solution explorer and selecting Add from the context menu. For all other install projects, you can use this technique, but for other project types, VS.NET offers a range of editors to specify the tasks to be performed by the setup project, and you'll find that using these editors gives you greater flexibility. These editors are all available under the VS.NET View, Editor menu whenever you select the setup project in solution explorer.

To add files, you need to use the File System Editor. (You might find that VS.NET opens this editor automatically when you create the setup project, but if not, it's under the View , Editor menu along with all the other setup project editors.) The File System Editor has a classic Windows Explorer-style treeview and listview. The treeview for a Windows setup project by default contains three items: Application Folder, User's Desktop, and User 's Program Menu, as shown in Figure 20.7.

Figure 20.7. The File System editor treeview.

graphics/20fig07.gif

These are so-called virtual folders, conceptual folders that represent locations to which files and shortcuts might be installed by the setup program:

  • Application Folder is the folder that the user specifies in the Installation Folder dialog when installing the application.

  • User's Desktop is the desktop on the installation machine.

  • User's Programs Menu represents the All Programs menu of the desktop Start menu.

To add files to the folder to which the software will be installed, simply right-click on Application Folder in the tree view and select Add from the context menu. You see the option to create a subfolder under Application Folder , to add the project output from the project, and to add a specific file or shared assembly from the developer machine. To add the generated files from a project in the solution, select Project Output , and then select the appropriate project and type of output from the dialog that appears.

Figure 20.8 shows the File System Editor after project output consisting of the primary output and localized resources from two projects has been added. Note that this same situation was the example shown earlier of creating a setup project using the wizard.

Figure 20.8. The File System Editor after adding project outputs.

graphics/20fig08.gif

Comments

The File System Editor is of course available whether or not you use the wizard to create the project. The wizard simply provides a quick way of initially choosing the project output to add to the setup project. The File System Editor is slightly harder to use but offers more flexibility, including the ability to create subfolders under Application Folder and add files to those subfolders . In many cases, you use the wizard to create a project roughly along the lines you need and then use the File System Editor to fine-tune the files to be deployed.

You can also add project output to the User's Desktop and User's Programs Menu items in the File System Editor, but in practice, you are more likely to add shortcuts to these folders.(You'll see how to do so in the next recipe.)

Note that the three virtual folders listed by default in the File System Editor constitute only a small number of the virtual folders available. To see the complete list, just right-click on the root File System node in the treeview, and select Add Special Folder from the context menu. Other locations on the target computer to which you can add files include the Program Files folder, the Windows System folder, the Start menu, and the User's Favorites folder.

 <  Day Day Up  >  


Microsoft Visual C# .Net 2003
Microsoft Visual C *. NET 2003 development skills Daquan
ISBN: 7508427505
EAN: 2147483647
Year: 2003
Pages: 440

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net