Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Windows and update to net7 #8

Closed
wants to merge 12 commits into from
Closed

Conversation

juwens
Copy link

@juwens juwens commented Sep 1, 2023

work in progress

blocked by: AvaloniaUI/Avalonia#12782

major

  • added
  • update to net7
  • update to a regular stable avalonia release (11.0.4)

minor

  • renamed ".xaml" to ".mxaml" (see caveats)
  • renamed the MauiSample to MauiSampleApp so the two projects are less ambigues.

caveats

  • due to an shortcoming of avalonia, which tries to parse every xaml file, and terminates and throws an error if it fails, i needed to rename every maui xaml file. analouge to the ".axaml" for ava convention i chose ".mxaml" for maui.

…Writeline"

next step is to add a actual MAUI App/Window
does not compile with strange xaml compile errors

2>------ Build started: Project: MauiSampleApp, Configuration: Debug Any CPU ------
2>CSC : error AXN0002: XamlX.XamlParseException: Unable to resolve type Shell from namespace http://schemas.microsoft.com/dotnet/2021/maui Line 2, position 2.
2>CSC : error AXN0002: XamlX.XamlParseException: Unable to resolve type ContentPage from namespace http://schemas.microsoft.com/dotnet/2021/maui Line 2, position 2.
2>CSC : error AXN0002: XamlX.XamlParseException: Unable to resolve type Application from namespace http://schemas.microsoft.com/dotnet/2021/maui Line 2, position 2.
2>CSC : error AXN0002: XamlX.XamlParseException: Unable to resolve type ResourceDictionary from namespace http://schemas.microsoft.com/dotnet/2021/maui Line 3, position 2.
@juwens juwens mentioned this pull request Sep 1, 2023
@juwens juwens changed the title Add Windows and update to net7 #7 - Add Windows and update to net7 Sep 3, 2023
@juwens juwens changed the title #7 - Add Windows and update to net7 Add Windows and update to net7 Sep 3, 2023
@juwens
Copy link
Author

juwens commented Sep 8, 2023

@kekekeks i tricked the build (for the while beeing) by renaming all maui xaml files to mxaml, like you ava does with axaml.

To workaround this issue: #7 (comment)

I also needed to disable FluentTheme, because it could not be resolved.

<!--<FluentTheme Mode="Light"/>-->

@juwens
Copy link
Author

juwens commented Sep 8, 2023

it starts, no avalonia rendering visible yet (but that is expected, cause there is no code for that yet)

image

- it broke with the update to the official avalonia 11.0.4 nugets, cause themes are in a separate nuget now. And the FluentTheme-Class does not have the Mode property anymore.
@maxkatz6
Copy link
Member

maxkatz6 commented Sep 9, 2023

due to an shortcoming of avalonia, which tries to parse every xaml file, and terminates and throws an error if it fails

It parses xaml files only if they were added in csproj with <AvaloniaView Include=".xaml" />. You don't need these.

I also needed to disable FluentTheme, because it could not be resolved.

Add Avalonia.Themes.Fluent package

@juwens
Copy link
Author

juwens commented Sep 9, 2023

@maxkatz6

thx for taking a look into it.

It parses xaml files only if they were added in csproj with <AvaloniaView Include=".xaml" />. You don't need these.

I think you missed the point where i already analysed and explained that in the issue.

You can try it yourself with my PR (just reset some commits before i renamed to mxaml). In the csproj no single xaml file was added to AvaloniaView.

You can look at the the binlog analysis, the problem has two main components:

  1. maui implicitly adds all xaml files to ItemGroup AdditionalFiles (this is no problem, and acceptable behavior)
  2. ItemGroup AdditionalFilesare are passed to the csc and the source-generators
  3. AvaloniaNameGenerator sourcegen parses all ".xaml", ".paml", "*.axaml" files in the AdditionalFiles list
  4. it fails critical if the xaml file (from the AdditionalFiles ItemGroup) is a maui file

#7 (comment)

#7 (comment)

@maxkatz6
Copy link
Member

@juwens hi! I just updated main branch to Avalonia 11 with .NET 7. Seems to work fine at least on Android.

There were some issues with Kotlin StdLib on android though.

I added workaround for your issue with AdditionalFiles by disabled Name source generator, which is optional for Avalonia (it won't generate c# properties for x:Name xaml elements). I created AvaloniaUI/Avalonia#12855 to track this issue.
Either way, it shouldn't block this PR anymore, and mxaml file format is optional now.

@juwens
Copy link
Author

juwens commented Sep 18, 2023

@maxkatz6 thanks, i'm very grateful for your help. That'll definitely help.

Cause i try to add maui-windows (WinUI), i discovered an impediment (the lack of a WinUI "AvaloniaView"). Currently i'm digging into the whole platform-abstraction of avalonia and try to implement an AvaloniaView for WinUI AvaloniaUI/Avalonia#12782

@cesarchefinho
Copy link

@maxkatz6 thanks, i'm very grateful for your help. That'll definitely help.

Cause i try to add maui-windows (WinUI), i discovered an impediment (the lack of a WinUI "AvaloniaView"). Currently i'm digging into the whole platform-abstraction of avalonia and try to implement an AvaloniaView for WinUI AvaloniaUI/Avalonia#12782

if you can add windows and browser without maui, in the same solution as maui hybrid , then we can implement specific code in windows project or in browser project and dont use maui in these plataforms...

see #12

@juwens
Copy link
Author

juwens commented Nov 28, 2023

I close it for now, as there are several outstanding things to be solved before continuing here.
But i'll try to do a second attempt when i can.

@juwens juwens closed this Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants