NetSparkleUpdater / NetSparkle

NetSparkle is a C#, cross-platform, highly-configurable software update framework with pre-built UI for .NET developers compatible with .NET 4.6.2/.NET 6+, WinForms, WPF, and Avalonia; uses Ed25519 signatures. View basic usage here in the README and try the samples for yourself.
https://netsparkleupdater.github.io/NetSparkle/
MIT License
615 stars 85 forks source link

Disentangle core lib from UI libs #600

Closed Deadpikle closed 1 week ago

Deadpikle commented 2 months ago

If we want other libraries to be able to use our user interfaces for their own software update processes that may not use the core of NetSparkleUpdater at all, we should remove the use of NetSparkle from the user interface libraries. The user interfaces can be passed just the information they need.

For example:

Related: #77

Deadpikle commented 2 months ago

NOTE: When working on #605, to get things compiling again, I intentionally messed up AppCastItem use. AppName and AppVersionInstalled no longer exist on AppCastItem, so the UIs had to be fixed. As I didn't want to start this issue's refactor immediately, I intentionally swapped out the vars used to something different and noted it in TODOs to fix later. So, if you build from source before a new preview is available, this will be a bug until that's fixed!

This is working again

Deadpikle commented 1 month ago

Very much considering just removing the new AsmResolverAccessor in lieu of always using AssemblyDiagnosticsAccessor by default, which would remove the extra lib from NetSparkle. It's not a huge loss, and if the default assembly path finding works, then users will probably be OK. Need to test that out in a real app as before, with reflection, we basically just loaded the running DLL, but now that we are trim-safe and don't use reflection here, we need the actual path to the actual DLL.

Notably, I don't know if this will work on macOS when inside a .app file. May need to put this in the release notes and make sure users know about this breaking change.

Can also make a tweak and see if https://stackoverflow.com/questions/4764680/how-to-get-the-location-of-the-dll-currently-executing is trim safe. (System.Reflection.Assembly.GetExecutingAssembly().Location) Don't know right now. I doubt it. Reflection and trimming don't play nice together.

Deadpikle commented 1 week ago

Decided not to use AsmAssemblyAccessor. No real benefit to using this compared to AssemblyDiagnosticsAccessor and removes ~1 MB from the library.

For now, the UI cleanup is done. The UI is still attached to the core lib, but things are significantly smaller now and make use of less of the core NetSparkle now, so I'm happy with things for the moment.