PDA

View Full Version : Passing ProductVersion to EXE CA



JordanIrwin
01-09-2006, 03:59 PM
I'm having difficulty passing the ProductVersion property to a custom action (executable). My project is an InstallScript MSI Project (IS v11.5), and I am launching a Custom Action during my installation to handle database updates. My custom action has been compiled into an EXE (it's a .NET console app, that accepts command line arguments and returns either 0 (success) or 1603 (failure). I am running the CA after the OnGeneratedMSIScript action, as a Deffered Execution. My CA requires two parameters (technically one, you'll see), the Installation path and the Version number. I can successfully pass the [INSTALLDIR] property, but the [PRODUCTVERSION] property is blank. I have pasted my "Command Line" property for the CA below, it may look funny. Let me explain why.

Since INSTALLDIR is a long string with spaces, I am surrounding it with quotation marks (sort of). When I put the quotation mark on the left and right side, it does not work (the spaces are parsed as new arguments). Doing it this way (with only a quotation on the left side) allows me to pass the entire command line as a single arugment, then I simply parse them out by the comma in my CA. Maybe this is a bug, or I'm not doing something right. Heck, it could be related to my problem.


Command Line for CA:
"[INSTALLDIR],[PRODUCTVERSION]


Anyway, the problem is the PRODUCTVERSION is always empty. Any suggestions? Thanks in advance.

Ryan A
01-09-2006, 04:21 PM
Well, I'm not 100%, or even 50% sure on this, but in my setup I have a property I created called BUILDNUMBER, which I set at build time to the same thing as the ProductVersion property, and I'm going to take a wild guess and say I did it because I couldn't access the ProductVersion property using [ProductVersion]. It's been there for awhile so I don't remember exactly why I did it that way...

So anyway, when I need to get the ProductVersion, I just use [BUILDNUMBER] and everything is happy.

titelee79
01-09-2006, 09:31 PM
If you are trying to use the default property for the version of the product (as displayed in Installation Information\General Information\Product Properties\Version), then the property you should use is "ProductVersion" and not "PRODUCTVERSION".

Unless you have created "PRODUCTVERSION" and assigned it a value, it will initially be null or empty I believe.

Thus, your command line should be:
"[INSTALLDIR]" "[ProductVersion]"

-:edit:-
Or in your case (parsing with the comma):
"[INSTALLDIR],[ProductVersion]"

JordanIrwin
01-10-2006, 09:04 AM
Thanks for the replies.


titelee79 - I figured it was something silly/easy like that. Your solution(s) work just fine.

Ryan A - Your solution worked as well. At least now I know how to circumvent the system if I ever need access to properties I normally can't get to.