5

I'm trying to add platform-specific code for iOS to my .NET MAUI app.

I'm targeting an iPhone with net6.0-ios:

enter image description here

However, Visual Studio thinks I'm targeting Android:

enter image description here

Compiling and running the app works fine (breakpoints within iOS preprocessor directive are hit), but it's a hassle to have to implement the iOS-specific code outside of the conditional preprocessor directives (with a bunch of warnings saying types aren't available) to be able to get some IntelliSense.

I'm suspecting this is a bug, but curious if there's any workaround?

Edit: Not a bug, I was just being an idiot not realizing the code editor and debugging target don't necessarily have to be one and the same.

Ted Nyberg
  • 7,001
  • 7
  • 41
  • 72

1 Answers1

6

Look in the first picture you posted, at upper left corner. ...App (net6.0-android). That is current value of a dropdown, that determines which project Intellisense uses. Change that to iOS.

ToolmakerSteve
  • 18,547
  • 14
  • 94
  • 196
  • Holy smokes, I didn't even notice! I was so focused on `net6.0-ios` being selected as the target framework for debugging. I feel like an absolute tool. Thank you! – Ted Nyberg Oct 22 '22 at 07:56
  • I didn't notice that dropdown too, I've been conditioned to ignore the dropdowns there. – Edgar Aug 08 '23 at 07:37