This documentation is archived and is not being maintained.

FileDeployer Class

Visual Studio 2008

Used to transfer files between the smart device and the desktop computer.

Namespace:  Microsoft.SmartDevice.Connectivity
Assembly:  Microsoft.SmartDevice.Connectivity (in Microsoft.SmartDevice.Connectivity.dll)

public class FileDeployer

This class does not have any constructors. To get an instance, use Device.GetFileDeployer.

using System;
using System.Collections.ObjectModel;
using Microsoft.SmartDevice.Connectivity;
using System.Windows.Forms;

class source
    static void Main(string[] args)

        // Get the datastore object
        DatastoreManager dsmgr = new DatastoreManager(1033);

        // Get the platform object
        Platform platform = GetPlatformByName("Windows Mobile 5.0 Pocket PC SDK", dsmgr);

            // Get the default device in the platform, usually an emulator.
            Device device  = platform.GetDevice(platform.GetDefaultDeviceId());


            if (device.IsConnected())
                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\");
                while (installer.HasExited() != true)

                // Display the version of .NET CF on the device after installation. 
                if (!cgautil.HasExited()) cgautil.Kill();
                cgautil.Start(@"\windows\cgacutil.exe", "");



        catch (System.Exception e)

    // ReturnS a platform if the supplied name can be found in the datastore. 
    // Returns null pointer if platform cannot be found 
    private static Platform GetPlatformByName(string p, DatastoreManager dsmgr)
        // Get all platforms in the datastore.
        Collection<Platform> platforms = dsmgr.GetPlatforms();

        // Find the platform whose name matches the parameter. 
        foreach (Platform platform in platforms)
            if (platform.Name == p) return platform;
        return null;



Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.