dotnet / dotnet/android

Unify `Run` MSBuild target behavior

Open
#12,577 0 comments 0 reactions 0 assignees View on GitHub
Area: App+Library Build
Dominant language
C#
Stars
2.1k
Forks
579
Avg merge
1d 20h
Merged PRs (30d)
257

Description

### Android framework version

net12.0-android

### Affected platform version

.NET 12

### Description

The Android run path currently has separate execution behavior across the legacy `Run` / `_Run` MSBuild targets and the SDK-driven `ComputeRunArguments` path used by `dotnet run` and `dotnet watch`.

For .NET 12, unify these paths so all Android application launches go through `Microsoft.Android.Run`:

- Delete the legacy `_Run` compatibility target.
- Remove the custom Android launch/debug implementation from the `Run` target path.
- Make `Run`, `dotnet run`, and `dotnet watch` use `Microsoft.Android.Run` consistently.
- Remove obsolete Mono-specific launch and debugger behaviors that are no longer required in .NET 12.
- Preserve required activity resolution, device selection, port mapping, force-stop, wait/no-wait, instrumentation, and logcat behavior through the canonical runner.

CoreCLR debugger ownership and setup are implemented by the vscode-maui extension, including the native debugger libraries and runtime configuration. See [DevDiv/vscode-maui PR 716837](https://dev.azure.com/devdiv/DevDiv/_git/vscode-maui/pullrequest/716837) for background. The dotnet/android run layer should provide the common application-launch and ADB plumbing without duplicating IDE-owned CoreCLR debugger setup.

This is intentionally deferred to .NET 12 so .NET 11 can fix `dotnet run` / `dotnet watch` port forwarding without changing existing Mono behavior.

### Steps to Reproduce

N/A — planned .NET 12 run-path consolidation.

### Did you find any workaround?

For .NET 11, keep the legacy `Run` / `_Run` behavior unchanged and add the required forwarding to the SDK-driven `ComputeRunArguments` / `Microsoft.Android.Run` path.

### Relevant log output

N/A

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the legacy Run and _Run MSBuild targets alongside ComputeRunArguments and Microsoft.Android.Run. Compare how dotnet run, dotnet watch, and direct Run launches handle activity resolution, device selection, port mapping, stopping, waiting, instrumentation, and logcat. Done means all Android launches use Microsoft.Android.Run without duplicated Mono-specific or IDE-owned debugger setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system, mobile-dev, tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.