Skip to content

Add ADB file push support for device file operations #12074

Open

Description

@rmarinho

Summary

Add support for pushing content/files to a device via ADB, enabling the MAUI DevTools CLI to write files to connected devices without going through ServiceHub.

Context

The VS Code MAUI extension currently uses the C# ServiceHub (AndroidDeviceManager.createFile()) to push files to Android devices. This is used during debugging to write XAML Hot Reload environment variables to the device filesystem. As part of the ServiceHub → CLI migration, we need this as a library API.

What the ServiceHub does today

From Microsoft.VisualStudio.Maui.Devices:

  • createFile(deviceSerial, remotePath, content) → writes content to a temp file, then runs adb -s <serial> push <tempFile> <remotePath>

Consumer

  • VS Code extension: MauiAndroidPlatform.ts → setXamlToolsEnvironmentVariables() (writes env config file to device for XAML Hot Reload)

Proposed API

Add to AdbRunner:

`csharp
// Push a local file to the device
Task PushFileAsync(string deviceSerial, string localPath, string remotePath, CancellationToken ct = default);

// Push string content to a remote path (writes to temp file, pushes, cleans up)
Task PushContentAsync(string deviceSerial, string content, string remotePath, CancellationToken ct = default);

// Pull a file from the device (optional, nice-to-have)
Task PullFileAsync(string deviceSerial, string remotePath, string localPath, CancellationToken ct = default);
`

CLI Command (downstream in dotnet/maui)

Once the API exists here, the MAUI DevTools CLI will expose:
maui android adb push --device <serial> --remote-path <path> --content "..." --json maui android adb push --device <serial> --remote-path <path> --local-path <file> --json

Related

Activity

  1. added
    enhancement
    on Mar 12, 2026
  2. added
    android-tools
    on Jul 13, 2026
  3. added
    needs-triage
    on Jul 13, 2026
  4. removed
    needs-triage
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    android-toolsenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions