Build MAUI library targeting .NET6 should have a Platforms folder (like for Windows, Android, iOS, Tizen)
See original GitHub issueDescription
Hello,
I want to add UnitTest to my MAUI project. What I need to do is to add “.NET6.0” to the target frameworks.
I followed https://www.youtube.com/watch?v=C9vIDLQwc7M A video of our famous Gerald Versluis 😃
Previously I had this:
<TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
<OutputType Condition="'$(TargetFramework)' != 'net7.0'">Exe</OutputType>
If I had net.7.0; I have an error while registering my services : the compiler is looking for MyServiceImplementation in a Platforms/PlatformNameHere and it doesn’t find any.
Maybe we should be able to create a folder “default” or “classic” or “core” or “base” i don’t know. Where you can declare service that are used as fallback service when no platform specific service is found. Or it could also be used when targeting .NET only instead of .NET Android .NET iOS etc.

Look the last screenshot : it finds an implementation for each platform except the classic one. I don’t want to include the MyServiceNET7 into the assembly MauiAndroid where I already have MyServiceNET7Android.
Public API Changes
No public API changes: only improvment
Intended Use-Case
I want to be able to unit test my MAUI project with ease
Issue Analytics
- State:
- Created a year ago
- Comments:7 (3 by maintainers)

Top Related StackOverflow Question
@nk53 All other code outside of Platforms can be compiled as NET6 and add net60; to your <TargetFrameworks>. If you want a folder that is specific ONLY to net6, you can add the following to your csproj:
IMO “net7.0” isn’t a “fallback”, it’s a standard platform. The code where you’re adding services could be run on “net7.0”, which includes apps like console apps. You could wrap that call in a platform directive so it wouldn’t be run on net7.0 and only on the platforms and you wouldn’t need to write the implementation.
IMO this feels more like a misunderstanding of how to lay out code rather than something that would need yet another abstraction within MAUI to handle.