IDE Features Supporting Device Application Packaging
To package a solution for deployment to smart devices, you use the same or similar Visual Studio integrated development environment (IDE) features that you use for desktop solutions. These features are described in the following table.
Feature |
How to Find |
Remarks |
---|---|---|
Smart Device CAB project template |
On the File menu, point to Add, click New Project, click Other Project Types, and then click Setup and Deployment. |
Click icon to add a new CAB project to your existing solution. Note that this is the only project type in this dialog box that is valid for smart devices. After you select a name for the CAB project and click OK, the project is added to the solution and is displayed in Solution Explorer. |
File System Editor |
Right-click the CAB project name in Solution Explorer, click View, and then click File System |
Use this editor to specify which files to add to the CAB and the device folders into which they should be installed. |
Registry Editor |
Right-click the CAB project name in Solution Explorer, click View, and then click Registry. |
Use this editor to specify any special registry keys required by your application. |
Properties Window for the CAB project |
Click the CAB project in Solution Explorer, and then click Properties Window on the View menu. |
Use this window to specify the name, if you have one, of your CE Setup DLL, the manufacturer name of your application, the minimum and maximum versions of Windows CE that your application is designed to run on, and other options. |
Project Property Pages |
Right-click the CAB project name in Solution Explorer, and then click Properties. |
Use this dialog box to specify configuration (for example, Debug), output file name, and security certificates. |
Note
Because these same editors are used for desktop setup projects, some options may be disabled for smart device CAB projects.
In some cases, you may write an application that is only designed to run on particular platforms, such as Windows Mobile 2003 SE and later. In these cases, you can prevent your CAB file from installing on the unsupported platforms that you specify. However, you must manually modify the INF file and repackage the CAB by using command-line tools. If you repackage the CAB by using Visual Studio, your changes will be overwritten.
Pocket PC vs. Smartphone
On Windows Mobile 2003 SE and earlier, the primary difference between CAB files for Pocket PC and those for Smartphones is that Pocket PC does not support compressed or signed CAB files. Smartphone CAB files must be compressed and both the .exe or .dll file and the CAB file itself must be digitally signed before they can be installed on the device. For more information, see Security in Device Projects.
Native vs. Managed Applications
The only difference between creating a smart device CAB project for an application written in C++ compared to one written in Visual C# or Visual Basic is that with native applications, you must manually add the system dependencies, atl80.dll, mfc80U[d].dll, and/or msvcrt[d].dll, to the CAB project. For managed applications, you will never add any .NET Compact Framework DLLs to your CAB file. However, your application must determine whether the correct version of .NET Compact Framework is installed on the device. You can do this by checking Version on the target device. If the correct version is not present, you must copy and install the appropriate .NET Compact Framework installation CAB file (drive:\Program Files\Microsoft.NET\SDK\CompactFramework\version\WindowsCE) to the device.
Warning
When you redistribute a native application that dynamically links to MFC/ATL, and deploy the MFC/ATL runtime DLLs to the application directory, the application may not link to the DLLs in that directory. On Windows CE, if two DLLs have the same file name but different paths, only the first DLL with that file name is loaded. Subsequent DLLs with the same file name are not loaded. Instead, the application links to the DLL with that file name that had previously been loaded by another application. To ensure that the application links to the DLLs in its directory, make sure that no other applications are using DLLs by using the same file names.
Smart Device versus Desktop Deployment
Both desktop and device setup projects can be accessed in the New Project dialog box, by clicking Other Project Types, and then clicking Setup and Deployment. When deploying a desktop application, you have the choice of Setup Project, Merge Module Project, Cab Project, Web Setup Project, and Setup Wizard. None of these project types can be used for device applications. ClickOnce deployment is not supported for smart devices. To create a CAB file for deployment to any Windows CE-based device, including Smartphone and Pocket PC, you must use the Smart Device CAB project.
See Also
Tasks
Walkthrough: Packaging a Smart Device Solution for Deployment