views:

469

answers:

2

I am using InstallShield 2010 and was wondering if anyone knows how to do the following:

I want to get the version of my main exe within my installer and make it the name of my setup.exe InstallShield is generating. Any idea how to do that?

+2  A: 

There are several ways you could do this....depending on your IS project type (MSI, installscript, etc.)

1) create a variable such as Product_Name in the Property Manager, set it in your installscript and retrieve it to modify your *.exe name

2) Using SQL, you can programatically get the product_name and set the *.exe name. Search the Direct Editor (Installation Designer -> Additional Tools -> Direct Editor) for the exact location of the table/value you need. For example (below), using VBScript, I modify the path to the installation root of the files I pull into the IS project. Similarly this can be done for any table in the IS Direct Editor. Using a tool such as Visual build Pro I believe would help you out as well. It's well worth the ~$100!

    Set oMSI = CreateObject("WindowsInstaller.Installer")
    On Error Resume Next

    ' open ISM file in transacted mode
    Set oDB = oMSI.OpenDatabase("C:\Path\to\myProject.ism", 1)

    strQuery = "Select * FROM `ISPathVariable` WHERE `ISPathVariable`.`ISPathVariable` = 'InstallTreeFolder'"

'////////////////////////////////////////////////////////////  
'// Update Path Variable

' fetch the one and only samplesource record
Set oView = oDB.OpenView(strQuery)
oView.Execute
Set oRec = oView.Fetch

' change field 2, the Value field
oRec.StringData(2) = "%INSTALL_TREE_ROOT%"

' update the changed record
oView.Modify 2, oRec

' close the view, commit changes, clean up
oView.Close: oDB.Commit: Set oMSI = Nothing
Japster24
I tried your first suggestion (#1), but InstallShield does not let you use variables in the Setup File Name.
Jeff Stock
+1  A: 

I was able to use the Automation services to accomplish this, which is the programming interface for InstallShield. Whenever I build my project in Visual Studio for my exe I run an exe in the Post-build that sets the InstallSheild project to be the same version.

Jeff Stock