Two Ways to Create Distribution Units

   

You can use two different methods for generating a distribution unit. These two methods apply to all three types of distribution units (setup, cabinet, and .zip).

You can create distribution units two different ways in the Microsoft development environment. You can:

  • Create an in-place packaging configuration of any of the three types for a single Visual J++ project.

  • Create a distribution unit project of any of the three types in the solution.

The first method is to use the "in-place" packaging configuration of a Visual J++ project. You can specify in the property pages of the Visual J++ project that when the project is built, the outputs of the project should be placed in a setup, cabinet, or .zip file. You can only add one in-place packaging configuration to each Visual J++ project.

The second method is to create a distribution unit project. A distribution unit project can contain the outputs of many projects. You can add as many distribution unit projects to your overall project or solution as you like. You can add different types of distribution unit projects to your solution, as well.

Tip   To see the properties for a distribution unit project, right-click the project and point to Properties. To see the properties of an in-place packaging configuration of a Visual J++ project, right-click the Visual J++ project, and point to Properties. On the Properties dialog box, choose the Output Format tab and click Advanced.

Understanding Project Outputs

With the Microsoft development environment, you use "outputs" of a project to control the files placed in a distribution unit or to control the deployed files. The "outputs" of a project are the set of files that are required at run time to run the project. For example, the outputs of a Visual J++ applet project would be the HTML pages and Java class files. The outputs of a Visual J++ project can be set by the user on the Project Properties Deployment Property tab, where the user can specify either the file types (for example, *.class) or file names. So, if you are creating a cabinet file by adding one or more Visual J++ projects to a cabinet project, you can control which specific files end up in the cabinet project by modifying the file types or names on the Deployment Property tab for that Visual J++ project.

Creating In-Place Packaging Configuration for a Visual J++ Project

The in-place packaging configuration provides a simple method to quickly package the components you are building in a Visual J++ project. You can specify that when the project is built, the outputs of the project should be placed in a cabinet, Zip Archive, or setup distribution unit. You can specify this on the Visual J++ project's property pages. You cannot create more than one in-place distribution unit per project, however.

Specifically, to create an in-place packaging configuration, you simply select the project's properties, and on the Output Format property tab, specify the following.

  • The type of distribution unit (cabinet, setup, Zip, Windows .exe file, or Windows .dll file).

  • The project output files that should be put into the distribution unit. You can specify the file types by extension (for example, *.class) or specify the names of the specific files to be included.

  • Any additional files that are not part of your project.

You can also set the properties specific to the type of distribution unit you choose. You can reach the appropriate property pages by going to the Output Format page, and then clicking Advanced.

Once these properties are set, a distribution unit will be built each time the project is built. The distribution unit is also available as a deployable output of the project.

Creating Distribution Unit Packaging Projects

With the Microsoft development environment, you can package many projects into a single distribution unit, such as a cabinet, Zip, or setup executable. This way, you can distribute the outputs of several projects with a single file.

Distribution unit projects are development environment projects whose only purpose is to generate .cab, .zip, or setup (.exe) files. There are three types of packaging projects: cabinet, setup executable, and Zip Archive projects. These projects can be added to a solution (by selecting Add Project and in the Add Project dialog box, selecting Visual Studio, and then clicking the Distribution Units node).

Distribution unit projects can contain the following two kinds of information.

  • References to the project outputs of other projects.

  • Files that are included in the distribution unit when it is built.

Referencing Other Project Outputs in a Packaging Project

The project outputs contain references indicating:

  • When the distribution unit is built.

  • The referenced project built.

  • The outputs from the referenced project included in the distribution unit.

For example, when you build "MyCabinetProject," any projects will be built, and the outputs of both projects will be put into a cabinet file generated by "MyCabinetProject."

Including Additional Files in a Distribution Unit

You can also add files to a distribution unit that are included when you build the distribution unit. These files may or may not require building on their own.

For example, when you build "MyCabinetProject," a file such as "flowers.bmp" and "readme.txt" will be put into the cabinet file generated by "MyCabinetProject."