Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Research WinAppDeploy for Windows 10 Mobile #110

Open
NickAb opened this issue Nov 10, 2015 · 1 comment
Open

Research WinAppDeploy for Windows 10 Mobile #110

NickAb opened this issue Nov 10, 2015 · 1 comment

Comments

@NickAb
Copy link
Contributor

NickAb commented Nov 10, 2015

Windows 10 mobile and Windows 10 Kit (C:\Program Files (x86)\Windows Kits\10\bin\x86) contains some interesting features and code.

This might be very interesting as API provided by Microsoft.Tools.Connectivity lists interesting methods. E.g. RemoteDevice has methods for file manipulation and launching of processes. This is not yet tested, but might be very interesting in context of launching driver as separate background process.

Windows 10 devices (and emulators) can be discovered over network. To enable this feature on device go to Settings -> For Developers and choose Developer mode and enable Device discovery.

To be able to connect to device from host you will have to pair device and host.

  1. On device: press Pair.
  2. On host: run WinAppDeployCmd.exe devices to list devices and note guid or ip of device you are interested in
  3. On host: run WinAppDeployCmd.exe list -guid {0} -pin {1} where {0} is guid of device, {1} is pin displayed by device
  4. On device press Done in Pair device window

For emulators this will keep your device and host paired until restart of device or host. To keep emulator paired after restart create checkpoint and set it as default:

  1. In emulator chrome press Additional Tools button
  2. Navigate to Checkpoints tab
  3. Press New checkpoint
  4. Once checkpoint is created click radio button next to it, so that it becomes default checkpoint.

Now when emulator is restarted, it will load this checkpoint, including pairing status.

Following is a sample of how to deploy application from programmatically using this new interface:

public IRemoteApplication DeployApp(IDevice device, FileInfo appxFile, List<FileInfo> givenDependencies, Guid productId)
{
    string destinationIp;
    string sourceIp;
    int destinationPort;
    device.GetEndPoints(0, out sourceIp, out destinationIp, out destinationPort);

    var deploy = new Deploy();
    var address = IPAddress.Parse(destinationIp);
    var co = new ConnectivityOptions(address);

    if (Device.IsApplicationInstalled(productId))
    {
        Device.GetApplication(productId).Uninstall();
    }

    deploy.DoInstallOrUpdate(co, appxFile, givenDependencies, Deploy.DeployAction.Install, null);

    return device.GetApplication(productId);
}

Notes

  • This code will require SirepClient.dll and SirepInterop.dll to be put next to project output (or maybe in path).
  • productId can be found in app manifest.
  • Microsoft.SmartDevice.MultiTargeting.Connectivity and Microsoft.SmartDevice.Connectivity.Interface (found in GAC) will be needed for IDevice and IRemoteApplication.
  • Microsoft.Tools.Deploy.Host.Deploy and Microsoft.Tools.Deploy.Host.ConnectivityOptions (C:\Program Files (x86)\Windows Kits\10\bin\x86\WinAppDeploy.dll) will be needed for Deploy and ConnectivityOptions.
  • See deployment code from project on how to read manifest and get IDevice instance.
@NickAb NickAb changed the title Windows 10 Mobile and WinAppDeploy Research WinAppDeploy for Windows 10 Mobile Dec 17, 2015
@NickAb
Copy link
Contributor Author

NickAb commented Aug 1, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant