Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detection of upgrading in events #1739

Open
Dersei opened this issue Feb 6, 2025 · 1 comment
Open

Detection of upgrading in events #1739

Dersei opened this issue Feb 6, 2025 · 1 comment

Comments

@Dersei
Copy link

Dersei commented Feb 6, 2025

Hi, I'm trying to implement upgrading and encountered an unusual issue with IsUpgradingInstalledVersion() within the UIInitialized and UILoaded events.

The problem lies in the fact that this method relies on three conditions including session.Property("FOUNDPREVIOUSVERSION").IsNotEmpty(), however at this point, the property hasn't been set yet.

  1. LookupInstalledVersion() returns correct value of the installed version of the app though, so my question is: can this be used reliably within these events to detect upgrading?

  2. Additionally, could the logic in IsUpgradingInstalledVersion() be updated to something more like this?:

session.IsInstalling() && !session.IsModifying() &&
               (session.Property("FOUNDPREVIOUSVERSION").IsNotEmpty()  || session.LookupInstalledVersion() != null)

As far as I can tell that should work the same way for the current use case but also work correctly inside these two events.

Anyway, thanks for amazing work!

Edit: As far as I can tell the same situation is true when using this property inside view model of WPF dialog.

@oleg-shilo
Copy link
Owner

oleg-shilo commented Feb 8, 2025

You are right, these two events are special as they are executed at the very early stage of the MSI session.

Your proposal makes sense. I will implement it in the very next release.

Thank you for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants