So I have a Net8.0 Maui application that I'm trying to shoehorn unit testing into. Normally when I've done this in the past I've added a net8.0; target, and used conditional compilation to turn off certain features to enable testing. Example here works pretty well in most situations to exclude platform specific packages and such
<OutputType Condition="'$(TargetFramework)' != 'net8.0'">Exe</OutputType>
<ItemGroup Condition="'$(TargetFramework)' != 'net8.0'">
<PackageReference Include="DevExpress.Maui.CollectionView" Version="23.1.6" />
<PackageReference Include="DevExpress.Maui.Controls" Version="23.1.6" />
<PackageReference Include="DevExpress.Maui.Editors" Version="23.1.6" />
</ItemGroup>
However, the use of DevExpress itself has presented some issues as now I have XAML pages that have references to these libraries and excluding the xaml, but keeping it visible is elluding me. So I had hoped to accomplish what the Platforms folders do in regard to excluding files but keeping them visible within visual studio.
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<Compile Remove="**\MyPage.xaml.cs" />
<MauiXaml Remove="**\MyPage.xaml" />
</ItemGroup>
or
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<None Update="**\MyPage.xaml;">
</None>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net8.0'">
<None Update="**\MyPage.xaml.cs; />
</ItemGroup>
I've attempted quite a few permutations of the various inclusions, compilations etc, but either the files are not listed, the files end up not compiling for the normal app, or the unit test build. Devexpress seems to be of the opinion that they arn't going to support unit testing any code with the views from what I've gathered across the web and recommended splitting the project up to only have views in one project and any unit testable code in another.