Develop and deploy Pocket PC installer

xiaoxiao2021-03-06  84

Develop and deploy Pocket Pc installer author: Ralph Arvesen Vertigo Software, Inc. published in March 2003 MSDN translator: liu_sir applications: Microsoft® .NET Compact Framework 1.0 Microsoft Visual Studio® .NET 2003 Summary: Learn how to create a Independent .msi files, install applications on different Pocket PCs by running desktops. Develop deployment process automation, so you can easily create and package all necessary components to generate a .msi file. The sample code is provided in C # and VB.NET languages. (21 Print Page) Download Sample Code Deployment.msi Content: Overview Deployment Uninstall Development Development Process Automation Overview Pixabay below listed as developed and deployed by Pocket PC applications: ● Pocket PC devices have different processor types (such as ARM , SH3, MIPS, etc.). ● The installer is deployed with .cab format. ● Cabwiz.exe generates a .cab file for a particular processor. ● WinCE Application Manager deploys and installs the .cab file on the desktop system to the Pocket PC device. We first discharge the deployment and unloading processes, then the automation of the development and development process. Deploying users can copy and run the appropriate .cab file to their devices, but a better solution is to load the application to the device by running a .msi file on the desktop. .msi installation file detects the model of the device, copy the correct .cab file to the device, then run this .cab file installation application. All processes are transparent to users; users can only be automatically installed on the Pocket PC as long as the user runs a .msi file on the desktop system. Below is the steps about the .msi file deployment: ● The user runs the .msi file on their desktop. ● The MSI file is encapsulated into a .cab file, setup.ini, and a custom installation component of a particular processor. ● The installation component is called during the installation process, running the WinCE Application Manager (Wince Application Manager) and the correct .cab file to the device by the installation component. ● The setup.ini file provides the application information of the application to the WinCE Application Manager. The following diagram illustrates the parties associated with the deployment process, followed by the description of each part. Figure 1. Contains each module in the deployment process. MSI file .msi file is a separate file that can be installed from your Pocket PC application from the desktop. The user runs the .msi file, which is unpackd to a specific processor. CAB file, a custom installation component, and a setup.ini file. The .cab file is installed on the device by running the .cab file. These files are self-extracting files that contain all files needed to install instructions and applications. These files are for different processors, so the processor supported by each application requires a separate .cab file. Installing Components This is a custom component called during installation. It runs WinCE Application Manager, copy and install the correct .cab file to the device. The setup.ini file describes the initialization file of the application information to the WinCe application manager, which is essential in the WinCE Application Manager installation application. WinCE Application Manager WinCE Application Manager is located on a user's desktop system for installation and uninstalling applications on a Pocket PC device. The following figure shows that the Application Manager prompts the user to install the sample application on the Pocket PC device. Figure 2. Install a Pocket PC application from the desktop Uninstall. Thecab file stores installation information on the Pocket PC, so the application can be uninstalled.

Users can uninstall the application directly on the Pocket PC or uninstall from the desktop. Using the Pocket PC to uninstall the application, users can choose to delete applications in the application settings shown below. Figure 3. Uninstalling an application using the Pocket PC When you install, the user can uninstall the application from their desktop. Select the program you want to uninstall from the Add Delete program under the Control Panel application and click the Delete button. This process calls custom installation components, which make WinCE Application Manager run in uninstall mode (no need to specify a setup.ini file). The user removes the pair check on the application, and click OK to uninstall the application on the Pocket PC. Figure 4. To uninstall a PocketPC program from the desktop system Development Setup Development Setup is to generate a .msi file with the smallest workload (if possible, click the mouse). First let's take a look at the parts involved in the development installer process: ● BuildCab.bat turns the installation process by running the CAB wizard. ● Information file (.inf) provides an application description to the CAB Wizard. ● The CAB wizard generates a different .cab file according to the processor type indicated by the .inf file. ● .cab file, a custom installation component and a setup.ini file being packaged into one .msi file. The following chart illustrates the parties associated with the installation development process, next to the description of each part. Figure 5. Related to the relevant section of the installation development process Generates a .cab file that generates a specific processor by running the CAB wizard tool. When you choose to generate a CAB file from the Generative Menu, Visual Studio generates a template buildcab.bat file. Let Microsoft® Visual Studio® generate this file, then copy it to a different path, then do some changes are a good way. It is very likely that only changes are to specify a new path for .cab and log files. The buildcab.bat in the example is shown below. C: / Program Files / Microsoft Visual Studio .Net2003 / CompactFrameworksdk / V1.0.5000 / Windows CE /../ bin /../ bin / bagwiz.exe

"C: / Program Files / PocketPC Deploy

Sample / Source / CS / PocketApp / Buildcabs / PocketApp_ppc.inf "/ DEST

"C: / Program Files / PocketPC Deploy

Sample / Source / CS / PocketApp / Buildcabs / Cabs "/ Err Cabwiz.ppc.log / CPU

ARMV4 ARM SH3 MIPS X86 WCE420X86

Information file (.inf) Microsoft Windows® CE .NET .INF file specifies installation settings and application files to the CAB wizard. Such as buildcab.bat files, when generating a CAB file is selected, Visual Studio generates a template .inf file. You should first build this file with Visual Studio, then copy to another path to do some changes. This file usually requires a small modification; usually modify the name of the Provider. Visual Studio generates a .inf file contains references to vsd_setup.dll. This DLL is used for version check and if the Pocket PC is not properly installed .NET thinboard, report this information. Take it a good note in your application, but for clearer, we remove it from the sample code. The .inf in the example program is as follows. You can access Microsoft Windows CE .NET: CREATING An .Inf file to get multi-information. Signature = "$ windows nt ___ fckpd ___ 1quot; provider =" sample company "

Cesignature = "$ Windows CE__FCKPD___1quot;

[Cestrings]

Appname = "PocketApp"

InstallDir =% CE1% /% appname%

[CEDEVICE]

Versionmin = 3.00

VersionMax = 4.99

[DefaultInstall]

CESHORTCUTS = SHORTCUTS

CopyFiles = files.common

[SOURCEDISKSNAMES]]

1 =, "Common1", "C: / Code / Microsoft / Pocket PC

Whitepapers / Deployment / Code / CS / PocketApp / Obj / Release / "

[SOURCEDISKSFILES]]

PocketApp.exe = 1

[DestinationDIRS]

FILES.COMMON = 0,% installdir%

Shortcuts = 0,% CE2% / Start Menu

[Files.common]

PocketApp.exe ,, 0

[Shortcuts]

PocketApp, 0, PocketApp.exe,% CE11%

The CAB Wizard Cabwiz.exe generates a .cab file that can be installed on a different Pocket PC device. A .inf file is passed as the first parameter of the command line to describe the application. Other optional parameters are destination paths, error log files, and CPU types. You can visit you can Visit Microsoft Windows CE .NET: CAB Wizard Syntax Get more information. Installing Components Custom Installation Components Automation Automation is implemented by handling AfterInstall and AferUnInstall events and running the WinCE Application Manager. The path to the WinCE Application Manager is stored under the registry hklm / software / microsoft / windows / currentversion / app paths / cEAppmgr.exe. Below is the code for the AfterInstall and AferunInstall events. C #

Private Void Installer_AFTERINSTALL (Object Sender,

System.configuration.install.installeventargs e)

{

// Get Fullpath to .ini file

String arg = path.combine (asmbly.GetexecutingAsembly (). location),

"Setup.ini");

// Run Wince App Manager to Install .cab File on Device

Runappmanager (ARG);

}

Private vid installer_afterunInstall (Object Sender,

System.configuration.install.installeventargs e)

{

// Run App Manager in Uninstall Mode (WITHOUT ANY ARGUMENTS)

Runappmanager (NULL);

}

Private void Runappmanager (String Arg)

{

// Get Path to the app manager

Const string regpath = @ "Software / Microsoft / Windows /"

@ "CurrentVersion / App Paths / CEAPPMGR.exe";

RegistryKey Key = registry.localmachine.opensubKey (RegPath);

String appmanager = key.getvalue ("") as string;

IF (AppManager! = NULL)

{

// Launch the app

Process.start

String.format ("/" {0} / ", appmanager,

(arg == null)? "": String.format ("/" {0} / ", arg);

}

Else

{

// Could Not Locate App Manager

MessageBox.show ("Could Not Launch The Wince Application Manager.");

}

}

VB.NET

Private subinstaller_afterInstall (Byval Sender As Object, _

Byval e as system.configuration.install.installeventArgs_

Handles mybase.afterInstall

'get fulpath to .ini file

Dim arg as string = path.combine (path.getdirectoryName)

System.Reflection.Assembly.GetexecutingAssembly (). Location), _

"Setup.ini")

'Run Wince App Manager to Install .cab File on Device

Runappmanager (arg)

End Sub

Private subinstaller_afterunInstall (byval sender as object, _

Byval e as system.configuration.install.installeventArgs_

Handles mybase.afterunInstall

'Run App Manager in Uninstall Mode (WITHOUT ANY ARGUMENTS)

Runappmanager (Nothing)

End Sub

Private Sub Runappmanager (Byval Arg As String) 'Get Path To The App Manager

Const regpath as string = "Software / Microsoft / Windows /" & _

"CurrentVersion / App Paths / CEAPPMGR.exe"

Dim key as registrykey = registry.localmachine.opensubKey (RegPath)

DIM Appmanager as string = cstr (key.getvalue (""))

IF not (appmanager is nothing "

IF arg is nothing then

Process.start (String.Format ("{0}" ", appmanager))

Else

'Launch the app

Process.start (_

String.format ("{0}" ", appmanager), _

String.Format ("{0}" ", arg))

END IF

Else

'Could Not Locate App Manager

MessageBox.Show ("Could Not Find App Manager)

END IF

End Sub

Setup.ini files. INI files describe application information when the WinCE Application Manager deploys an application to the Pocket PC device. The following is an example of Setup.ini. You should set the version, Description, and Cabfiles properties in your application. You can access Microsoft Windows CE 3.0: Creating An .ini File for the Application Manager to get more information about .ini files. [CEAppManager] Version = 1.0 Component = App [App] Description = Sample Pocket PC application. CabFiles = PocketApp_PPC.X86.CAB, PocketApp_PPC.ARM.CAB, PocketApp_PPC.ARMV4.CAB, PocketApp_PPC.MIPS.CAB, PocketApp_PPC.SH3.CAB PocketApp_ppc.wce420x86.cab .msi file This is a file that is distributed to the user. It contains modules necessary to deploy Pocket PC applications from the desktop to different Pocket PCs. Installation Process Automation Now You are already familiar with all modules related to the installation development process. Let's take a look at how the generation process is automated. The points are as follows: ● Create a solution containing multi-engineering (Pocket PC App, Customer Installer, and Setup). ● Add custom installation components to the installation and uninstall custom action. ● Use a pre-generating event to call the buildcab.bat file to generate .cab files. ● Specify the project's dependencies to generate the project in the correct order. ● Set the Debug configuration and release configuration of the Pocket PC program with the configuration manager. The following sections describe the C # and VB.NET example solutions more detailed. C # Solutions Click the mouse to generate all items (Pocket PC applications, custom installation components, and .msi files). VB.NET Release requires more steps, due to the lack of these two properties: 1. One solution does not include VB.NET projects of different platforms (Pocket PC applications cannot be in the same solution in the same solution) ). 2. Prechase and generate a command event is not supported in any VB.NET project. The VB.NET scheme can still be automated, but it is more convenient than the C # version. Solutions and Project C # Solutions include three items: PocketPC App, Custom Installer, and Setup. The PocketPC App project is a Pocket PC-based smart device application. The Custom Installer project is a custom installation component. Install the project to pack all the projects into one .msi file. The following is a C # solution. Figure 6. There are two solutions that include PocketPC App, Custom Installer, and Setup project VB.NET. The first includes a smart device project PocketApp. The second solution generates a .msi file, including CustomStaller, pre-build, and setup projects. CustomStaller and Setup projects are the same as the projects in C #, pre-generating projects is a C Makefile project; pre-generating projects do not include any C code, just to specify a pre-compiled event. The VB solution is shown below.

Figure 7. VB.NET solution containing Pocket PC, Installer Component, pre-build and setup projects PocketApp project PocketApp is a simple smart device project, "Hello World" application; a PocketPC simple program. BuildCab.bat and PocketApp_ppc.inf files are used to generate .cab files, setup.ini files for deploying applications. File App.ico is an application icon file that is displayed in the program workgroup of the Pocket PC. The following shows that the application icon is specified in C # and VB.NET. Figure 8. Specify the application icon in C # 9. Specify the application icon in VB.NET. Figure 10. Displayed the icon CustomStaller project in the Pocket PC application group This component runs the WinCE Application Manager to deploy it. The CAB file is on the Pocket PC device. C # and VB.NET code has been described above. Setup Project Installation Project Generates a .msi file includes a .cab file, CustomerInstaller installation component, and setup.ini files for a particular processor. The CustomerInstaller component adds to the response to the install and uninstall custom action, as shown in the following figure. Figure 11, adding the response to install and uninstall custom action, after the PocketApp project is generated, you need to run BuildCab.bat to generate .cab files. Visual Studio does not allow you to generate post-generated command events for C # Intelligent Device Projects. So we'd better specify a precommitted command event for the CustomerInstaller project. Figure 12. With a pre-bure command event to generate. CAB file Visual Studio does not allow VB.NET projects to have any generated events, so we use a C Makefile project to define pre-generated events, as shown below. Figure 13. Using a C pre-generating event as a VB.NET solution Project Relying on the solution that the solution contains many projects, it is important to set the correct generated order. For C #, the generation order is set to PocketApp, CustomStaller and Setup, as shown below. Figure 14. Setting the Sequence for the C # Solution Settings VB.NET version contains two solutions; the PocketApp solution should be generated first, then the PocketPCsetup solution is pressed. The generation order of the SETUP solution is shown below. Figure 15. Specifying the Generator Configuration Manager Configuration Manager Configuration Manager for generating a Pocket PC project in the Release mode in the Release mode. That is, only for the application Pocket PC application, you don't have to experience the entire generation process. The configuration of the C # version is shown below. This configuration does not need in VB.NET because one of the solution is for Pocket PC, and another solution is used to generate .msi files. Figure 16. Generate only the Pocket PC project in Debug mode Figure 17. Generate all items in Release Mode Installation and Generation Example Solution The following is the point of installation and generating sample solutions. ● Run the PocketPC deployment program Sample.msi file, install C # and VB.NET to your system. Points the link to the Visual Studio solution file Add below the PocketPC Deploy Sample group in the Start menu. ● The hardcodes in buildcab.bat and pocketApp_ppc.inf files are updated to match your system (example to install the path of the folder and Visual Studio). You should check the path information of these files, if you have trouble when you generate sample programs.

转载请注明原文地址:https://www.9cbs.com/read-121709.html

New Post(0)