Skip to content

[xabt] fix $(AdbTarget) passed in#10740

Merged
grendello merged 1 commit intomainfrom
dev/peppers/dotnet-run-fix
Jan 30, 2026
Merged

[xabt] fix $(AdbTarget) passed in#10740
grendello merged 1 commit intomainfrom
dev/peppers/dotnet-run-fix

Conversation

@jonathanpeppers
Copy link
Copy Markdown
Member

@jonathanpeppers jonathanpeppers commented Jan 28, 2026

I found two issues testing dotnet run:

  • If you have two devices connected, first is an arm64 device, second is x86_64 emulator.

Issue 1

  • The _ResolveMonoAndroidSdks MSBuild target sets $(AdbTarget) based on $(Device) global MSBuild property.

  • The _GetPrimaryCpuAbi MSBuild target runs first and doesn't have the correct value for $(AdbTarget)!

I fixed this by setting $(AdbTarget) late during evaluation, in Xamarin.Android.Common.targets.

Issue 2

In 105d912, I added Microsoft.Android.Run project to make dotnet run show live adb logcat output.

Unfortunately, I forgot to add a switch for "adb target", so it did not properly select a device.

Added the --adb-target switch to fix this.

I found two issues testing `dotnet run`:

* If you have two devices connected, first is an arm64 device, second
  is x86_64 emulator.

~~ Issue 1 ~~

* The `_ResolveMonoAndroidSdks` MSBuild target sets `$(AdbTarget)`
  based on `$(Device)` global MSBuild property.

* The `_GetPrimaryCpuAbi` MSBuild target runs *first* and doesn't have
  the correct value for `$(AdbTarget)`!

~~ Issue 2 ~~

In 105d912, I added `Microsoft.Android.Run` project to make `dotnet
run` show live `adb logcat` output.

Unfortunately, I forgot to add a switch for "adb target", so it did
not properly select a device.

Added the `--adb-target` switch to fix this.
@jonathanpeppers
Copy link
Copy Markdown
Member Author

New test is working:

image

@jonathanpeppers jonathanpeppers marked this pull request as ready for review January 29, 2026 16:59
@grendello grendello merged commit 2ef4a4d into main Jan 30, 2026
6 checks passed
@grendello grendello deleted the dev/peppers/dotnet-run-fix branch January 30, 2026 08:59
jonathanpeppers added a commit that referenced this pull request Jan 30, 2026
I found two issues testing `dotnet run`:

* If you have two devices connected, first is an arm64 device, second
  is x86_64 emulator.

~~ Issue 1 ~~

* The `_ResolveMonoAndroidSdks` MSBuild target sets `$(AdbTarget)`
  based on `$(Device)` global MSBuild property.

* The `_GetPrimaryCpuAbi` MSBuild target runs *first* and doesn't have
  the correct value for `$(AdbTarget)`!

~~ Issue 2 ~~

In 105d912, I added `Microsoft.Android.Run` project to make `dotnet
run` show live `adb logcat` output.

Unfortunately, I forgot to add a switch for "adb target", so it did
not properly select a device.

Added the `--adb-target` switch to fix this.
jonathanpeppers added a commit that referenced this pull request Feb 4, 2026
I found two issues testing `dotnet run`:

* If you have two devices connected, first is an arm64 device, second
  is x86_64 emulator.

~~ Issue 1 ~~

* The `_ResolveMonoAndroidSdks` MSBuild target sets `$(AdbTarget)`
  based on `$(Device)` global MSBuild property.

* The `_GetPrimaryCpuAbi` MSBuild target runs *first* and doesn't have
  the correct value for `$(AdbTarget)`!

~~ Issue 2 ~~

In 105d912, I added `Microsoft.Android.Run` project to make `dotnet
run` show live `adb logcat` output.

Unfortunately, I forgot to add a switch for "adb target", so it did
not properly select a device.

Added the `--adb-target` switch to fix this.
simonrozsival pushed a commit that referenced this pull request Feb 5, 2026
I found two issues testing `dotnet run`:

* If you have two devices connected, first is an arm64 device, second
  is x86_64 emulator.

~~ Issue 1 ~~

* The `_ResolveMonoAndroidSdks` MSBuild target sets `$(AdbTarget)`
  based on `$(Device)` global MSBuild property.

* The `_GetPrimaryCpuAbi` MSBuild target runs *first* and doesn't have
  the correct value for `$(AdbTarget)`!

~~ Issue 2 ~~

In 105d912, I added `Microsoft.Android.Run` project to make `dotnet
run` show live `adb logcat` output.

Unfortunately, I forgot to add a switch for "adb target", so it did
not properly select a device.

Added the `--adb-target` switch to fix this.
@github-actions github-actions bot locked and limited conversation to collaborators Mar 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants