icsharpcode / ILSpy

.NET Decompiler with support for PDB generation, ReadyToRun, Metadata (&more) - cross-platform!
21.72k stars 3.36k forks source link

Add Support to export Avalonia UI axaml file #2587

Open unofficialdev opened 2 years ago

unofficialdev commented 2 years ago

It seems that in avalonia applications the axaml match file is compiled to c# code. is it possible to add support for outputting axaml interface files as it was originally? Image 2

siegfriedpammer commented 2 years ago

is it possible to add support for outputting axaml interface files as it was originally?

I guess so... rather, the question is: who will add it?

unofficialdev commented 2 years ago

Do you have any workaround for this goal? i think we need something like baml decompiler

siegfriedpammer commented 2 years ago

For those interested in adding support for this:

image

We could add support for the binary/XML mixture format in !AvaloniaResources and add the nodes for the individual Avalonia XAML files as child nodes to that node, just as we do now for .resources files.

The BAML decompiler already uses that approach to resolve the connection ids back to x:Name and event handlers. See https://github.com/icsharpcode/ILSpy/blob/master/ILSpy.BamlDecompiler/Rewrite/ConnectionIdRewritePass.cs#L116-L200

Hope this helps!

If anyone is interested in contributing such a feature, please get in touch with me, so I can provide you with answers to your potential questions. Thanks!

siegfriedpammer commented 2 years ago

Do you have any workaround for this goal? i think we need something like baml decompiler

The workaround is manually translating ILSpy's output, sorry.

christophwille commented 2 years ago

See also issue https://github.com/icsharpcode/AvaloniaILSpy/issues/70 in AvaloniaILSpy repo.