[Maui] Order of imported files is incorrect
Closed this issue · 2 comments
After adding the appropriate imports to the Maui template and converting it to F#, most of the code seems fine.
Except Maui seems to include by default all Platforms/**/*.*
files including fs
files.
But F# needs all the shared code to be imported before Platforms
since Platforms
files need to reference MauiProgram.fs
.
Also F# doesn't seem happy about multiple entry points (one for iOS, one for macCatalyst), but this may be due to those files not being the last one of their respective targets (net6.0-ios
, net6.0-maccatalyst
).
Looking good though. Only a bit of MSBuild files to fix and it should run.
Seems like everything is imported by this file: https://github.com/dotnet/maui/blob/1bc403e424fe26594b7de1ad8e72c45e567bdaff/src/Workload/Microsoft.Maui.Sdk/Sdk/AutoImport.props
It's a props
file, so it get imported before our own files.
I tried disabling the auto import and did exactly the same than AutoImport AFTER my own files and it works! 😄
I think what is needed is to change AutoImport.props
to AutoImport.targets
and F# should be happy.
Disabled auto import of files with <EnableDefaultItems>false</EnableDefaultItems>
and imported them manually
https://github.com/fabulousfx/net6.0-mobile-fsharp/blob/136f6e3cae61195eca6884bcfde8cd7759dfd6ec/net6.0-maui-fsharp/content/MauiApp.fsproj#L45-L108
Now it's working.