We are trying to make our app based on MAUI with DevExpress build on Android and Windows. As we know, for now DevExpress does not support Windows, so we decided to make separate Views for Android (with DevExpress) and Windows (with MAUI controls). We are using C# preprocessor directives to exclude DevExpress from compiling while targeting Windows, the entire file is closed in #if ANDROID
like this and everything works fine for C# files but we have problem with XAML files, if we are using DevExpress in xaml and we will try to build our app targeting Windows, we will get this error: CS0400 The type or namespace name 'DevExpress' could not be found in the global namespace (are you missing an assembly reference?) Namespace.MAUI (net6.0-android)
in this auto generated file. Build works for android.
We tried moving our DevExpress view to platform/android folder (with proper namespaces) or using this solution to exclude our custom view or/and auto generated file like this in project file:
<Project>
[...]
<ItemGroup Condition="$(TargetFramework.StartsWith('net6.0-android')) != true">
<Compile Remove="**\Microsoft.Maui.Controls.SourceGen.CodeBehindGenerator\CustomControls_DevExp_CustomGridViewDevExp.xaml.sg.cs" />
<None Include="**\Microsoft.Maui.Controls.SourceGen.CodeBehindGenerator\CustomControls_DevExp_CustomGridViewDevExp.xaml.sg.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
<Compile Remove="**\DevExp\**\*.cs" />
<None Include="**\DevExp\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
<Compile Remove="**\DevExp\**\*.xaml" />
<None Include="**\DevExp\**\*.xaml" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
<Compile Remove="**\DevExp\**\*.xaml.cs" />
<None Include="**\DevExp\**\*.xaml.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>
</Project>
but without success.
For now, as workaround we are writing DevExpress views in C# code without XAML and using preprocessor directives and everything works ok, but is there any other (better) way to fix this error?
Thanks!