NetSparkleUpdater / NetSparkle

NetSparkle is a C# cross-platform software update framework for .NET developers compatible with .NET 4.6.2/.NET 6+, WinForms, WPF, and Avalonia; uses Ed25519 or DSA signatures! View basic usage here in the README or visit our website for code docs.
https://netsparkleupdater.github.io/NetSparkle/
MIT License
585 stars 81 forks source link

How to set mandatory updates and miniversion #552

Open howzew opened 5 months ago

howzew commented 5 months ago

It is my first time to use this library. When the update program is started, the update window does not seem to have the focus and can be closed alone. How can I set the forced update? In addition, can I set the minimum update version? Thank you.

Deadpikle commented 5 months ago

@howzew Thanks for your questions.

How can I set the forced update?

This is intentional behavior. You can do a few things if you want to try to get the user to update their software:

  1. Set the app cast version as critical. You can use this via the app cast generator via the --critical-versions flag, e.g. --critical-versions 1.0.1.
  2. Use the UIFactory.ProcessWindowAfterInit function to make any modifications to the window you want to make after it's been created.
  3. Use your own UIFactory implementation to do what you want and show windows how you want to show them (e.g. as a dialog, etc.)
  4. Don't use a built-in UI at all and run your own UI. There's a sample called HandleEventsYourself that will help you know how to do this.

In addition, can I set the minimum update version?

This is not a built-in feature, but you can filter app cast items yourself based on the version of the software you're using and the versions in the app cast. Implement the IAppCastFilter XMLAppCast.AppCastFilter class member and run your own filtering.

In other words, for both of your questions, you can implement things in a custom way to get things running just as you'd like them. :-)

howzew commented 5 months ago

@Deadpikle Thanks for your reply. It seems that I need to implement it myself. These two functions are commonly used functions. so it would be very convenient if they can be built-in in 3.x. However, thank you for the method you provided, I will test it.