androidmaui

.NET MAUI: I have selected an Android physical device but VS compiles with iOS preprocessor directives


I have a MAUI project that is targetting an Android physical device, however, it seems Visual Studio thinks I am targetting an iOS device. Please see this screenshot:

enter image description here

This image shows the selected device for debug, however the opened file shows DAttendance (net8.0-ios) and the preprocessor directive IOS is defined, making that #if not working.

What is it going on here?


Solution

  • Please select the .net8.0-android:

    enter image description here

    This area's value will decide the platform you are coding target.