Switching Channels
By default, UpdateManager will try and search for releases in the same channel that it was built for. You can read more about packaging channels here. So normally, you should not provide a channel at all to the UpdateManager constructor.
If no channel was ever specified (neither at packaging time nor via ExplicitChannel), UpdateManager falls back to a default channel named after the current operating system's short name (for example win, osx, or linux). This matches the default channel vpk pack uses when you don't pass --channel.
However, from time to time, it may be useful to allow a user to switch channels without re-installing the application. For example, a user opts into getting "beta" features via your application settings. In that case, you can provide the channel explicitly:
new UpdateManager("https://the.place/you-host/updates", new UpdateOptions {
ExplicitChannel = "beta"
});
Also by default, the UpdateManager will only update to versions which are newer than the current version, leading to suboptimal behavior because often you may be switching to a version which is lower than the current version. Imagine the following scenario:
- You publish 2.0.0 to the
stablechannel. - You publish 2.0.1 through 2.0.5 to the
betachannel. - Your user installs 2.0.0
stable, and then opts-in tobetavia settings. - Your user can update from 2.0.0 -> 2.0.5 fine, because 2.0.5 is a newer version.
- Your user encounters a bug and turns off
betavia settings. - By default, UpdateManager will not install stable 2.0.0 because it is a lower version than 2.0.5.
For this reason, when switching channels it's recommended to use the ExplicitChannel option together with the AllowVersionDowngrade option. For example:
new UpdateManager("https://the.place/you-host/updates", new UpdateOptions {
ExplicitChannel = "beta",
AllowVersionDowngrade = true,
});
When AllowVersionDowngrade is enabled, the auto-apply-on-startup behavior will not apply the lower-or-equal version for you, so you must call an explicit apply method. See Targeting a specific version for the full details.