FileDeployer.DownloadPackage 方法
更新:2007 年 11 月
根据与特定的 CPU 相对应的给定数据包 ID 将数据包下载到设备上。
命名空间: Microsoft.SmartDevice.Connectivity
程序集: Microsoft.SmartDevice.Connectivity(在 Microsoft.SmartDevice.Connectivity.dll 中)
语法
声明
Public Sub DownloadPackage ( _
packageId As ObjectId _
)
用法
Dim instance As FileDeployer
Dim packageId As ObjectId
instance.DownloadPackage(packageId)
public void DownloadPackage(
ObjectId packageId
)
public:
void DownloadPackage(
ObjectId^ packageId
)
public function DownloadPackage(
packageId : ObjectId
)
参数
packageId
类型:Microsoft.SmartDevice.Connectivity.ObjectId唯一的数据包 ID。
备注
当在设备中部署了 CAB 安装程序后,像那些用于安装 .NET Compact Framework 和 SQL Server Compact 3.5 的安装包将不会自动运行。若要安装它们,必须手动使用 Microsoft.SmartDevice.Connectivity.RemoteProcess 启动安装。
示例
Dim fd As FileDeployer = device.GetFileDeployer()
' Deploy .NET Compact Framework 2.0 using the ID of its add-on package.
' Add-on packages are located in \ProgramData\Microsoft\Corecon\1.0\addons
fd.DownloadPackage(New ObjectId(New Guid("ABD785F0-CDA7-41c5-8375-2451A7CBFF26")))
Dim cgautil As RemoteProcess = device.GetRemoteProcess()
' Display the version of .NET CF on the device before installation.
cgautil.Start("\windows\cgacutil.exe", "")
' Run the cab installer with no UI prompt
Dim installer As RemoteProcess = device.GetRemoteProcess()
installer.Start("wceload.exe", "/noui \windows\netcfv2.wm.armv4i.cab")
While installer.HasExited() <> True
System.Threading.Thread.Sleep(1000)
End While
' Display the version of .NET CF on the device after installation.
If Not cgautil.HasExited() Then
cgautil.Kill()
End If
cgautil.Start("\windows\cgacutil.exe", "")
FileDeployer fd = device.GetFileDeployer();
// Deploy .NET Compact Framework 2.0 using the ID of its add-on package.
// Add-on packages are located in \ProgramData\Microsoft\Corecon\1.0\addons
fd.DownloadPackage(new ObjectId(
new Guid("ABD785F0-CDA7-41c5-8375-2451A7CBFF26")));
RemoteProcess cgautil = device.GetRemoteProcess();
// Display the version of .NET CF on the device before installation.
cgautil.Start(@"\windows\cgacutil.exe", "");
// Run the cab installer with no UI prompt
RemoteProcess installer = device.GetRemoteProcess();
installer.Start("wceload.exe", @"/noui \windows\netcfv2.wm.armv4i.cab");
while (installer.HasExited() != true)
{
System.Threading.Thread.Sleep(1000);
}
// Display the version of .NET CF on the device after installation.
if (!cgautil.HasExited()) cgautil.Kill();
cgautil.Start(@"\windows\cgacutil.exe", "");
权限
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。