Solitaire icon indicating copy to clipboard operation
Solitaire copied to clipboard

<PublishAot> prevents AXAML previewer from working

Open MikeyWetzel opened this issue 11 months ago • 2 comments

A fresh git clone and build of the solution in VS2022 results in none of the .axaml files working in the preview. The error shown is "Dynamic code generation is not supported on this platform."

I did a google search and found https://github.com/AvaloniaUI/Avalonia/issues/13760 where a commenter suggested: "Well, previewer cannot be supported with PublishAot binaries, as AOT doesn't support dynamic code which is essential for the previewer." I can verify the following suggestion did fix the problem. That fix is to add this line in Solitaire.Desktop.csproj:

	<PublishAot Condition="'$(Configuration)' != 'Debug'" >true</PublishAot>

Result: axaml files new appear at design time.

MikeyWetzel avatar Jan 13 '25 16:01 MikeyWetzel

Well, I'm not entirely working here. The fix about gets CasionView.axaml working, but App.axaml still shows the error.

MikeyWetzel avatar Jan 13 '25 16:01 MikeyWetzel

Application is explicitly not supported, I presume by design. See https://github.com/AvaloniaUI/Avalonia/blob/03f91a2c3d20160dad7dd60961ac272cc16f39aa/src/Avalonia.DesignerSupport/DesignWindowLoader.cs#L92-L93

There's not much value here to be had either, IMO, unless somebody needs to preview a multiwindow app at once.

stevemonaco avatar Jan 14 '25 07:01 stevemonaco