Loading
Comparing Versions in Basic MSI?
I'm trying to figure out how to compare versions in a Basic MSI project. I do a System Search and assign my IE version number (e.g. 7.0.5730.13) to a property. Now I want to do a conditional check to see if the version is at least some number (e.g. 6.0.0.0) and display an error window if the version isn't correct.

 

But I know the conditional builder doesn't support comparing versions using the normal operators, so how would I compare them? I could write an InstallScript custom action to call the VerCompare function, but is there a simpler way to compare them?

 

Edit: I also have another query. I have a condition that compares the built-in property ServicePackLevel to see if it's at least 2. A message displays if the condition fails, showing the value of ServicePackLevel and the value needed. I have the condition set to appear only if ServicePackLevel is less than 2, yet the error message appears showing ServicePackLevel is 2 (which is correct), but then the condition shouldn't have failed. I don't understand why this is happening. And I'm looking in the LaunchCondition table in the Direct Editor to make sure everything is set right.

  • Community Manager (Flexera Software)

    Windows Installer has no built-in version-comparison operator, but a system search for a file does support detecting if the found version is within a range you specify. The "Signature Table" topic has the details.
  • okay. but what about when I have an integer, such as the ServicePackLevel and am comparing it to another integer? That should work, it even has examples of it in the InstallShield Help pages. But for some reason it's coming back showing ServicePackLevel is less than the integer I'm comparing it with when they should be equal.
  • Community Manager (Flexera Software)

    Yes, that type of straightforward numeric comparison should work; could you copy and paste here the condition that works incorrectly?
  • ServicePackLevel < 2

     

    and I've tried:

     

    ServicePackLevel < "2"

     

    The message I have that prints out when the condition is true shows that ServicePackLevel is 2
    Expand Post
  • Community Manager (Flexera Software)

    The first format (without the quotation marks) is correct; if this is a launch condition, perhaps turn the condition around to ServicePackLevel>=2? That's the condition that needs to succeed, and the message is displayed if the condition fails.
  • okay, I believe you're right. The install condition lets the installer continue as long if the condition is true, and displays the message if it is false.

     

    I was learning from a installshield developer blog and that concept was reversed. It seems to be working now.

Loading
Comparing Versions in Basic MSI?