vigyanlabsmys
Posts: 73
Joined: Sat May 17, 2014 12:37 pm

Re: Exit installer if same version is found

Hi,

I want to write "Message: This version is already installed on your computer!" in log file, but I don't want to display a popup window to user in silent install. How to do this?
Best Regards,
Dan
vigyanlabsmys
Posts: 73
Joined: Sat May 17, 2014 12:37 pm

Re: Exit installer if same version is found

Hi,

I want to write "Message: This version is already installed on your computer!" in log file, but I don't want to display a popup window to user in silent install. How to do this?
Best Regards,
Dan
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Exit installer if same version is found

Hello,

Please take a look on our "Write a custom event in the log file" how to which should be useful for you.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vigyanlabsmys
Posts: 73
Joined: Sat May 17, 2014 12:37 pm

Re: Exit installer if same version is found

Hi,

In silent install, you have given following code, which is working fine. But when I checked in verbose log it showing "MainEngineThread is returning 0 (error code 0)" but according to msi Standard error codes (if same version is found ) error code is "1638". Why this is happening ?

Function MyVBScriptCA()
MsgBox "This version is already installed on your computer!"
'return error
MyVBScriptCA = 3
Exit Function
End Function

MyVBScriptCA()
Best Regards,
Dan
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Exit installer if same version is found

Hello,
In silent install, you have given following code, which is working fine. But when I checked in verbose log it showing "MainEngineThread is returning 0 (error code 0)"
Please keep in mind that when the return value of the installation process is 0 (e.g. "MainEngineThread is returning 0") this means the installation succeeded. I've tested your installation scenario and it seems this behavior is caused by a limitation of our "Execute inline script code" predefined custom action type. The above custom action type will not return an error even when a VBS function is returning an error code, thus the installation will move on and finish successfully.

However, after testing further your scenario it seems that in order to return an error code within a VBS custom action you should use a "Launch attached file" custom action. So, in order to achieve what you want you should delete the previous added "Execute inline script code" custom action and proceed like this:
1. create a VBS file (error_message.vbs) with the following content:

Code: Select all

Function MyVBScriptCA()
   MsgBox "This version is already installed on your computer!"
   'return error
  MyVBScriptCA = 3
  Exit Function
End Function
2. open you project and go to "Custom Actions" page
3. add a "Launch attached file" custom action after "Install Execution Stage -> Paths Resolution" actions group scheduled on maintenance only, with the following properties:
  • Attached File: Path_to_error_message.vbs
    File Type: Visual Basic Script (*.vbs)
    Function: MyVBScriptCA
4. build and test again your installation scenario

Now your "error_message.vbs" custom action should return and write in log file an error value (i.e. 3) and the installation process should end and write in the log file an installation error message too (MainEngineThread is returning 1603).
but according to msi Standard error codes (if same version is found ) error code is "1638". Why this is happening ?
Please keep in mind that the above error code (1638) is returned by the installation process only when you are trying to install a setup package having the same ProductVersion and ProductCode as an already installed setup, but a different PackageCode. For example, this may happen if you are building an installation package, install it, then open the project and alter the installation settings (e.g. add a new file) without changing the ProductVersion, rebuild it and try to install the new rebuilt setup again. Please take a look on our "Why do I receive the "Another version of this product is already installed" message?" faq which debates this error.

However, when a custom action within the installation process returns an error value, then the main installation process should end with 1603 error code (MainEngineThread is returning 1603).

If you have any questions let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vigyanlabsmys
Posts: 73
Joined: Sat May 17, 2014 12:37 pm

Re: Exit installer if same version is found

Thank you.
Best Regards,
Dan
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Exit installer if same version is found

You're welcome.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vigyanlabsmys
Posts: 73
Joined: Sat May 17, 2014 12:37 pm

Re: Exit installer if same version is found

Hi,

I have upgraded AD installer from 11.4 to 11.6. I have deleted the line "MsgBox "This version is already installed on your computer!""
I saved and closed the .aip file. When I reopened that project its showing that line. But this problem was not there in 11.4. So why this behaviour is happening ??

Function MyVBScriptCA()
MsgBox "This version is already installed on your computer!"
'return error
MyVBScriptCA = 3
Exit Function
End Function
Best Regards,
Dan
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Exit installer if same version is found

Hello,

I'm not sure I fully understand what behavior are you encountering. In order to have a clear view of the issue you are talking about, can you please try to iterate a concise step by step test case which we can easily use to replicate the behavior? You can also try to isolate the behavior in a sample (.aip + its referenced source files) and send it us to support at advancedinstaller dot com so we can investigate?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Dan
Posts: 4513
Joined: Wed Apr 24, 2013 3:51 pm

Re: Exit installer if same version is found

Hello,

This was fixed in version 14.4 of Advanced Installer released on October 26st, 2017.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vigyanlabsmys
Posts: 73
Joined: Sat May 17, 2014 12:37 pm

Re: Exit installer if same version is found

Hi, Dan

Thanks for the Help.

Best Regards,
Dan
Best Regards,
Dan
Catalin
Posts: 6582
Joined: Wed Jun 13, 2018 7:49 am

Re: Exit installer if same version is found

You are always welcome, Dan.

Kind regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”