Open ThadHouse opened 3 years ago
Ideally, I would expect AutoGeneratedProgram to be partial: https://github.com/dotnet/command-line-api/blob/72e86ec7615c0c8ecb6a13e34a5c0a97e9309909/src/System.CommandLine.DragonFruit/targets/System.CommandLine.DragonFruit.targets#L31
But having an attribute to find designer builder method also sounds good to me. I believe this piece of code should be modified for that.
I'll work on doing that this weekend. Its an easy change that can be done as a way that wouldn't change behavior of existing apps. Just need to finish cleaning it up and testing.
https://github.com/ThadHouse/Avalonia/commit/c96f5f86dec8107cc68e7cbe864f8725270e240e
Hello, @ThadHouse. Feel free to suggest your changes by PR :)
I was attempting to write a project where if I passed no arguments it would start a UI app, but if passed with arguments it would act like a command line app. To do the command line part and make it easy, I was using System.CommandLine.DragonFruit. That package rewrites an apps main program class into a class called AutoGeneratedProgram. However, the UI designer doesn't seem to like this, and fails with "AutoGeneratedProgram doesn't have a method named BuildAvaloniaApp". I know compatibility with things like this is hard, but I wonder if an attribute on the class containing BuildAvaloniaApp would be better, as anything that would rewrite Main() would still work just fine.