Get File Version

Got a problem you cannot solve? Try here.
Post Reply
tzachk
Posts: 171
Joined: Wed Jul 18, 2012 12:14 am

Get File Version

Post by tzachk »

Hello Installaware support

I can't get the Get File Version to work.
I read on the forum that this command has problems with managed, but I'm trying to get the version from a native exe/dll.
The command returns 0.0.0.0 even though the version is there in the properties.

Any idea?

Regards,
T.
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Get File Version

Post by FrancescoT »

Dear Tzachk,

I just used "Get File Version" to obtain an exe file version and works fine.

How are you using the command?
Is the file already available on target system when you run the command?

Regards.
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
tzachk
Posts: 171
Joined: Wed Jul 18, 2012 12:14 am

Re: Get File Version

Post by tzachk »

Hi Francesco,

I believe I'm doing it after the install, meaning that I call the get version after the "Install" command for the file.
Is this correct or should I try reading it after the "Apply Install" ?

This is rather confusing. I'm coming from NSIS, and though it was not nearly as sophisticated (although a delete folder for InstallAware could be helpfull) as InstallAware, the flow of things in the script were very clear.

For instance:
- where do I need to put a stop service before reboot? Thanks for the answer Francesco, though I'm following what you suggested, not because I understood why this is the correct place.
- I used reboot and resume during an uninstall thinking that the installer shall remember that the reboot is due to my selection of an uninstall, but after reboot it opens the same add/repair/remove dialog. Why?

I'm doing my best to read every piece of text I can find on installaware to find solution to my issues, but at the end I find myself asking in the forum or e-mailing Installaware support. Even for the most obvious things.

Is there a text somewhere that explaines when Apply Install, Apply Patch, Apply Advertised ....... are called? what do each means? What shall be the order of things after reboot and resume?

Sorry to include all the above in my answer but I'm quite frustrated.
Thanks,
T.
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Get File Version

Post by FrancescoT »

Dear Tzachk,

first of all I suggest to you to have a look to our pubblications available at:
http://www.installaware.com/publication ... papers.htm
Suggested white paper: MSIcode Scripting Technology for Windows Installer

http://www.installaware.com/publication ... guides.htm
I believe I'm doing it after the install, meaning that I call the get version after the "Install" command for the file.
Is this correct or should I try reading it after the "Apply Install" ?
If your setup in executed using Windows Installer Engine (as by default), all files and settings that are part of your setup are really available on target system only after Apply Install is executed. Pratically Consider Windows Installer Engine as a database where commands are stored and executed only when Apply Install is called.
This forum topic probably will help you more:
http://www.installaware.com/forum/viewt ... f=2&t=4338

Obviously a good place to find more infos about MS Windows Installer is directly from Microsoft's guides.

Finally before to start with your real project I suggest you the following:
- Start to experiment with InstallAware creating very simple projects. A good start for this is the document: "Using InstallAware to Deploy Microsoft .NET Framework Applications" (Available at: http://www.installaware.com/publication ... papers.htm). The document describe a NET app installation but it can easly adapted for any other use.
- Use the Samples and Templates available with InstallAware as starting point to work on. In most cases a lot of common installer tasks are already defined and ready to use.
- Once you are a little bit more familiar with installation process (I am sure that will not require you so much time), try to start your real project development.
For instance:
- where do I need to put a stop service before reboot? Thanks for the answer Francesco, though I'm following what you suggested, not because I understood why this is the correct place.
- I used reboot and resume during an uninstall thinking that the installer shall remember that the reboot is due to my selection of an uninstall, but after reboot it opens the same add/repair/remove dialog. Why?
With my suggestion I supposed that your service have to be stopped after pre-requisites execution but probably, it is not the good place to do that.
In order to help you I need to know exactly which are your needs. Probably if try to describe it using a logic flow example I will be able to help you.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
tzachk
Posts: 171
Joined: Wed Jul 18, 2012 12:14 am

Re: Get File Version

Post by tzachk »

Hi Francesco.

The flow of things is as follows.
New install:
- Checking pre-requisites
- Installing files to their relevant directories
- Replacing existing files in system32 if are older version
- Registering .NET and native COM
- editing XML files
- writing to registry some entries
- executing some custom executables
- Installing file system driver
- Installing office add-ins
- Installing windows service
- some other stuff.

Upgrade:
- put the service in manual
- make a copy of several installed files
- reboot
- uninstall software
- install upgrade software
- copy the old files overwriting the newely installed ones.
- start the service

Repair:
- Same as Upgrade

Uninstall:
- put the service in manual
- reboot
- uninstall the old software

Wishful, ability to support uninstalling old NSIS installation during new msi install:
- Detect that nsis is installed
- start nsis uninstaller
- reboot
- detect that nsis uninstaller is operating, and wait for it to complete
- install new msi as new installation.

The above flows are the ones I'm trying to support.

Regards,
Tzach
tzachk
Posts: 171
Joined: Wed Jul 18, 2012 12:14 am

Re: Get File Version

Post by tzachk »

Hi Francesco,

I would also appreciate it if you could outline the order in which install script regions are accessed for any scenario install/uninstall/repair/upgrade. How do I determine why one region should get executed.

The link you provided in regard to command execution order is very helpfull. I think that the place of such an explanation is in the user manual.


Regrds,
T.
tzachk
Posts: 171
Joined: Wed Jul 18, 2012 12:14 am

Re: Get File Version

Post by tzachk »

Hi Francesco,

In regard to Get File Version, I'm able to get it correctly if I ran the command after the Apply Install, but then I'm not able to write the value to the registry. The value is not written if I'm calling the write registry after the Apply Install.
If I run the Get File Version before the Apply Install, then I get 0.0.0.0, but then I can write to the registry.

Help?

Regards,
T.
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Get File Version

Post by FrancescoT »

Dear Tzachk,

please post one a question at a time and possibly use a different topic for each question... otherwise will be very difficult for me to follow properly.
I would also appreciate it if you could outline the order in which install script regions are accessed for any scenario install/uninstall/repair/upgrade. How do I determine why one region should get executed.
That it is easy! The script code instructions are conditionally executed.
For example:

Code: Select all

if Variable REMOVE Equals TRUE
  Comment: Uninstall product
  Comment: TO-DO: Insert any additional uninstall commands here
  Apply Uninstall (get result into variable SUCCESS)
  Set Variable PROGRESS to 100
else
The above instruction are executed only when the predefined variable REMOVE is TRUE.
More details about predefined variable meaning are available with IA documentation (search for "pre-defined variables").

In addition you can use IntallAware Debugging mode to watch over your code execution (search for "Debugging" in IA docs).
As developer you should be already familiar with the above concept.
In regard to Get File Version, I'm able to get it correctly if I ran the command after the Apply Install, but then I'm not able to write the value to the registry. The value is not written if I'm calling the write registry after the Apply Install.
If I run the Get File Version before the Apply Install, then I get 0.0.0.0, but then I can write to the registry.
As I already told you with my previous reply, The file Installation (Windows Installer Command "Install Files") is really executed only with Apply Install. This rule is followed by all the Windows Installer commands (PURPLE COMMANDS). This means that the effective execution of any of these command is deferred to Apply Install successful execution. By the way InstallAware offer the possibility to break this rule using the NATIVE SETUP ENGINE. The native code setup engine is capable of executing each Windows Installer based action without requiring Windows Installer on the target system. Additionally, the native code setup engine enables setup actions to execute immediately, without deferring them until Apply Install is called - unlike the Windows Installer engine (for more information please refer to IA documentation).

About your specific question you can use NATIVE ENGINE to accomplish your requirements.
For example, if you want to write the file version to registry after Apply Install,
place the command inside a NATIVE ENGINE ON/OFF statement :

Code: Select all

Set Variable NATIVE_ENGINE to TRUE
Write Registry Key HKLM\\, 
Set Variable NATIVE_ENGINE to FALSE
With the above code, the command "Write Registry" (PURPLE COMMAND) is executed immediately.

Hope this helps you.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
tzachk
Posts: 171
Joined: Wed Jul 18, 2012 12:14 am

Re: Get File Version

Post by tzachk »

Hi Francesco,

It helps a lot, thanks.

Regards,
T.
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Get File Version

Post by FrancescoT »

:D
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Post Reply