Fail MSI Execution based on a File in specific path - Advanced Installer Community
MohammudDaulgha
Posts: 7
Joined: Wed Aug 01, 2018 8:25 am

Fail MSI Execution based on a File in specific path

Hi Team,
I need to code in Advance Installer tool to fail the MSI when it find MSIError.log present in a specific path while the MSI is executing. Please let me know how to get this done from Advance installer.
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Fail MSI Execution based on a File in specific path

Hello,

In order to achieve what you want, you can firstly create a file search and use that search in a launch condition which will condition the execution of your setup based on the search result (if that search fails, it means MSIError.log was not found, thus your installation should continue, otherwise it will fail).

Here is a step-by-step you can follow in order to achieve this:

1) Go to "Search" page from the "Custom Behavior" group and create a new file search by clicking the "New File Search" from the toolbar.

2) Press the "..." button from the right side of the "Name" field to configure the search location. After doing so, you can rename the property which stores the result of your search by right clicking on the search --> "Rename". You can rename it to something more meaningful like:

Code: Select all

MSIERRORLOG_PROP
3) Now we have to create a custom lunch condition which will continue the installation only if the "MSIError.log" is not found. To do this, you can go to "Launch Conditions" page --> "Custom" tab --> press the "New..." button and enter the following parameters:
-Condition: NOT MSIERRORLOG_PROP
-Description: you can create any description which will detail the failure of your installation.

Hope this helps!

Regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
MohammudDaulgha
Posts: 7
Joined: Wed Aug 01, 2018 8:25 am

Re: Fail MSI Execution based on a File in specific path

Catalin wrote:Hello,

In order to achieve what you want, you can firstly create a file search and use that search in a launch condition which will condition the execution of your setup based on the search result (if that search fails, it means MSIError.log was not found, thus your installation should continue, otherwise it will fail).

Here is a step-by-step you can follow in order to achieve this:

1) Go to "Search" page from the "Custom Behavior" group and create a new file search by clicking the "New File Search" from the toolbar.

2) Press the "..." button from the right side of the "Name" field to configure the search location. After doing so, you can rename the property which stores the result of your search by right clicking on the search --> "Rename". You can rename it to something more meaningful like:

Code: Select all

MSIERRORLOG_PROP
3) Now we have to create a custom lunch condition which will continue the installation only if the "MSIError.log" is not found. To do this, you can go to "Launch Conditions" page --> "Custom" tab --> press the "New..." button and enter the following parameters:
-Condition: NOT MSIERRORLOG_PROP
-Description: you can create any description which will detail the failure of your installation.

Hope this helps!

Regards,
Catalin
Hi Catalin,
Thank you for your reply. "Launch Conditions" will work when the MSI start executing, but the MSIError.log will be created based on one of the custom action. From the custom action execution, the MSIError.log will be created. If the "MSIError.log" is found, then stop the installation of MSI.
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Fail MSI Execution based on a File in specific path

Hello,
Hi Catalin,
Thank you for your reply. "Launch Conditions" will work when the MSI start executing, but the MSIError.log will be created based on one of the custom action. From the custom action execution, the MSIError.log will be created. If the "MSIError.log" is found, then stop the installation of MSI.
In this case, you can use a "Display error message" custom action. If the file is found, then the error message will be displayed, thus your installation will fail. In order to achieve this, you can go to "Custom Actions" page and add a "Display error message" custom action. In order for this to work, please make sure to add your "Display error message" custom action after the custom action that creates your "MSIErrorLog".

Let me know if this helps!

Regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Fail MSI Execution based on a File in specific path

You're always welcome!

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

Return to “Common Problems”