This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Comparing Versions in Basic MSI?
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 11, 2010
05:34 PM
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.
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.
(6) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 11, 2010
05:54 PM
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.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 12, 2010
08:39 AM
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.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 12, 2010
09:40 AM
Yes, that type of straightforward numeric comparison should work; could you copy and paste here the condition that works incorrectly?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 12, 2010
10:30 AM
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
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 12, 2010
11:45 AM
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.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 12, 2010
02:06 PM
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.
I was learning from a installshield developer blog and that concept was reversed. It seems to be working now.