Useful to have option to get Product Version from main .exe

Request new features that you would like to see in the next version of Advanced Installer.
Mark Rogers
Posts: 3
Joined: Fri Aug 24, 2007 6:07 pm
Location: Edinburgh, UK
Contact:

Useful to have option to get Product Version from main .exe

Post by Mark Rogers » Fri Oct 12, 2007 1:21 pm

AI project files are really easy to maintain, but they could be maintenance free if there was an option in Product Details to extract the Product Version from the main executable.

This would make automated builds much easier - it would ensure app version/build was always in sync with installer Product Version. Also means I only have to change it in one place.

This was one of my pet hates about InstallShield: bumping the build number or app version was always a pain: check files out, open in IS, save files, check back in.

(I know you can use the Set Version command line option, but that requires a lot more effort: scripting to extract the version, check files out etc)

Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact:

Post by Cosmin » Fri Oct 12, 2007 2:45 pm

Hi,

We already have this on our TODO list and this feature will be available in a future version of Advanced Installer.
Thank you for your suggestion.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Peter Chr. Ryskin
Posts: 2
Joined: Sat Nov 17, 2007 11:57 am
Location: Denmark
Contact:

Post by Peter Chr. Ryskin » Sat Nov 17, 2007 12:01 pm

Hi,

For .NET executables it would be great to be able to choose between getting the version of the file (FileInfo) or the version of the contained assembly (Not equal).

Best,
Peter Chr. Ryskin

Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact:

Post by Cosmin » Mon Nov 19, 2007 4:28 pm

Hi,

We will consider including this feature in a future version of Advanced Installer.
Thank you for your suggestion.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

UnstoppableDrew
Posts: 32
Joined: Tue Oct 16, 2007 4:04 pm
Location: Burlington, MA USA
Contact:

Post by UnstoppableDrew » Mon Nov 19, 2007 5:56 pm

Peter Chr. Ryskin wrote:Hi,
For .NET executables it would be great to be able to choose between getting the version of the file (FileInfo) or the version of the contained assembly (Not equal).
I'll second this request. As I mentioned in another thread, our build system sets the AssemblyVersion field, but not the FileVersion, so I can't use /SetVersion -fromfile.

Dashut
Posts: 142
Joined: Tue May 04, 2010 4:41 pm

Re: Useful to have option to get Product Version from main .exe

Post by Dashut » Tue Feb 01, 2011 6:09 pm

I also need the file version of the file (FileVersionInfo structure in C#).
I have AdvancedInstaller 8.0.2: does it exist there?

Thanks, Dashut.

Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact:

Re: Useful to have option to get Product Version from main .exe

Post by Cosmin » Fri Feb 04, 2011 4:26 pm

Hi Dashut,

Unfortunately this feature was not implemented because it wasn't requested by many users. However, it's still on our TODO list and we will try to include it in a future version of Advanced Installer. I increased its priority.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Dashut
Posts: 142
Joined: Tue May 04, 2010 4:41 pm

Re: Useful to have option to get Product Version from main .exe

Post by Dashut » Sun Feb 06, 2011 4:04 pm

Until you create this feature: how can I do this in the installer? The problem is: even if I create a custom action under the "INSTALL" phase (where I know that the files are deployed/copied already on the installation folder): I can't modify the MSI Properties (at this stage: it's not accessable)! so I can't run some custom action that will do that for me....

How can I do this? I want the file version so that I will set the description of my Service with the correct fileVersion number. So when a User will go to Services.msc, and look at the description of the Service, he will be able to see which version of the product is installed...

Dashut.

Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact:

Re: Useful to have option to get Product Version from main .exe

Post by Cosmin » Mon Feb 07, 2011 2:18 pm

Hi Dashut,

A solution is to use a build script which sets ProductVersion through SetVersion command line option. It uses a "-fromfile" attribute which can help you.

Another solution is to create a custom action which reads the file version from the MSI and sets an installer property. This property can then be used by your service. Our user guide contains a sample DLL custom action which may help you. To read the MSI you can use Windows Installer API.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Dashut
Posts: 142
Joined: Tue May 04, 2010 4:41 pm

Re: Useful to have option to get Product Version from main .exe

Post by Dashut » Mon Feb 07, 2011 2:52 pm

1. I have a list of files that I want to get the version from.
2. I can only get the version of the files when I have passed/on the "install" phase.
3. In the "install" phase: you can't access windows msi Properties! meaning: the vbscript of custom action dll will NOT be able to access or set PROPERTIES.

So I don't think it will work this way.
Dashut.

Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact:

Re: Useful to have option to get Product Version from main .exe

Post by Cosmin » Mon Feb 07, 2011 5:04 pm

Hi Dashut,

I was referring to querying the MSI database through MsiDatabaseOpenView function. Basically, you would read the version directly from the File table. This can be done at any time during install.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Dashut
Posts: 142
Joined: Tue May 04, 2010 4:41 pm

Re: Useful to have option to get Product Version from main .exe

Post by Dashut » Mon Feb 07, 2011 6:02 pm

If you look at the guide at: http://www.advancedinstaller.com/user-g ... rties.html
you see the following comment:

Code: Select all

Deferred custom actions can receive information about the installation process, mostly only embedded in the CustomActionData property. However, this type of custom actions do not have access to installer properties.
which means: that in "install" sequence, you can't access Installer properties! So if I have all my files deployed/copied and now I'm in the "install" sequence, I can't have my custom action modify/access any Property!
So for example, I created (at first) a VBScript custom action that checks the version of my already installed file, but since the properties are not accessible: I can't do this:

Code: Select all

Session.Property("FILE_VERSION_RESULT") = fileVersion
because "FILE_VERSION_RESULT" properity is NOT accessible at this stage of the sequence.

so my code should have been:

Code: Select all

Function GetFileVersion()

' Get Installer properties
fileToCheck=Session.Property("FILE_NAME_TO_CHECK_VERSION")

' Create object to check file version
Set fso = CreateObject("scripting.filesystemobject")
fileVersion = fso.GetFileVersion(fileToCheck)

' Store the version
Session.Property("FILE_VERSION_RESULT") = fileVersion
 
End Function
but it fails, since properties: "FILE_NAME_TO_CHECK_VERSION" and "FILE_VERSION_RESULT" are not accessible/exist at this stage/sequence (for the VBScript session).
If I run the SAME custom action at an earlier sequence stage: then it will work, but it doesn't work for the "install" sequence.

Dashut

Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact:

Re: Useful to have option to get Product Version from main .exe

Post by Cosmin » Tue Feb 08, 2011 1:53 pm

Hi Dashut,

Like I mentioned in my previous post, the custom action can query the MSI database to get the version from File table. It doesn't use installed files. Since the MSI database can be queried at any time, you can use an Immediate custom action. This way you can set an installer property with the file version.

Basically, you Immediate custom action should:
- open the MSI database using Windows Installer API
- read the version from File table
- save that version into an installer property

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Dashut
Posts: 142
Joined: Tue May 04, 2010 4:41 pm

Re: Useful to have option to get Product Version from main .exe

Post by Dashut » Tue Feb 08, 2011 4:17 pm

Yes, I understand what you mean now.
Is there a way to do this with VBScript (run MsiDatabaseOpenView in VBScript: because then I can create one vbs file that does it all, while in C# I have to create a project...)?

Many thanks, Dashut.

Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact:

Re: Useful to have option to get Product Version from main .exe

Post by Cosmin » Tue Feb 08, 2011 4:31 pm

Hi Dashut,

Yes, you can use the Installer object. For example, to open the database you can use this code:

Code: Select all

Const msiOpenDatabaseModeReadOnly = 0
Dim installer, database
Set installer = CreateObject("WindowsInstaller.Installer")
Set database = installer.OpenDatabase(FileName, msiOpenDatabaseModeReadOnly)
Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Post Reply