After a Compact Framework solution has been developed, localized, and secured, it must be packaged and deployed. Fortunately, much of the work involved with packaging an application is taken care of by the SDP functionality in Visual Studio .NET 2003. And, once packaged, the application itself can be deployed in a variety of ways, depending on the connectivity characteristics of the devices. Some of these deployment patterns may also require some custom code development in order to integrate with ActiveSync or to create an auto-updating (a truly smart client) application.
In order to make decisions about how to deploy an application, the versioning system used in the Compact Framework must also be understood. The most important point to keep in mind is that the code-sharing model employed by the Compact Framework, as in desktop Framework, is exactly the opposite of that used by managed environments such as COM. In managed environments such as the Compact Framework, referenced assemblies are copied into the calling application's bin directory and are therefore said to be private assemblies. This allows applications to be isolated from one another and updated independently because two applications are not referencing the same assemblies.
Assemblies may also be explicitly shared by generating a strong name at compile time based on cryptographic information coupled with identity information (assembly name, version, and culture) that uniquely identifies the assembly. The assembly can then be placed in an intelligent registry of sorts on the device called the global assembly cache (GAC). The EE then consults the GAC when making binding decisions for shared assemblies. Manipulating the GAC on a smart device is much different from doing so on the desktop and involves deploying a text file that the EE inspects and uses to update GAC entries. Using the GAC saves space on the device by allowing multiple applications to reference the same shared assembly, and it allows changes to be made in one place, where all applications referencing the assembly can immediately take advantage of it.
To package a Compact Framework application, developers can use the features built into SDP by right-clicking on the project and selecting Build Cab File. SDP then builds .cab files for each supported processor type along with the source .inf and other files needed to customize and rebuild the .cab files. The appropriate .cab file can then be executed on the device, and the application installed.
To deploy the .cab files, various options are available, including using the Application Manager utility provided by ActiveSync, making the .cab files available on a Web site (internal or external) or file share (internal) and using a memory storage card, while taking advantage of the Autorun capability of Pocket PC devices. To ease the deployment of new assemblies in the application, developers can also add an auto-updating capability to Compact Framework applications that allows them to check for new assemblies, using one or more of the distribution methods just enumerated, and then download the updated assemblies before executing the application.