nskris
Posts: 21
Joined: Fri Oct 26, 2018 3:32 pm

Issues during Chain MSI install

Hi,
I have 2 child MSIs chained to 1 parent MSI. I am facing two issues -
1. I am trying to pass the MSILogFileLocation property into child MSIs by checking Enable logging and giving LogFile as [MsiLogFileLocation]. Iam providing the log file during runtime as command line argument(/L*V C:\Errorlog.txt). After the MSI is run, i can only see parent MSI contents. The child MSI contents are not present. Please let me know if iam missing something?
2. When a child MSI fails, it still proceeds with the next child MSI instead of failing the MSI process. Please let me know how to fail the main MSI when any of the child MSIs results in failure

regards,
Krishna
nskris
Posts: 21
Joined: Fri Oct 26, 2018 3:32 pm

Re: Issues during Chain MSI install

Please let us know if there is any way around these issues. I am stuck at this from long time.
Catalin
Posts: 6584
Joined: Wed Jun 13, 2018 7:49 am

Re: Issues during Chain MSI install

Hello Krishna,

First of all, I apologize for the delayed reply, but we had a holiday here (free day) and we also do not work over the weekend.

In what regards your issues:

1) I tested this on the version 15.5.1 of Advanced Installer and everything worked as expected. The content of the chained MSI package's log was inside the main package's log file. What version of Advanced Installer are you using?

2) This indeed happens if you have the "Rollback whole products installation if this package fails" option unchecked. To avoid such behavior, please go to "Prerequisites" page, click on your chained package and check that option for both of your chained MSIs.

Hope this helps.

Kind regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
nskris
Posts: 21
Joined: Fri Oct 26, 2018 3:32 pm

Re: Issues during Chain MSI install

Thank you. Issue no 2 is fixed now. I dont know how i missed that. Issue no 1 is still happening. Iam using 15.5.1 version. I have attached a screenshot of the same. Iam running the msi as - msiexec /i MSMain.msi /L*V F:\temp\msilog.txt. MSMain is the parent MSI. MS1 is the chained MSI. The content of msilog.txt has only MSMain content. It does not have MSI1 content.
Attachments
MSIissue.PNG
MSIissue.PNG (67.77 KiB) Viewed 4031 times
Catalin
Posts: 6584
Joined: Wed Jun 13, 2018 7:49 am

Re: Issues during Chain MSI install

Hello Krishna,

Indeed, you are right. It seems that when I have tested this, I went on a wrong route (I misunderstood your scenario). The [MsiLogFileLocation] property stores the full path to the log file of the main package (e.g. "F:\temp\msilog.txt") not the general path (e.g. "F:\temp"). This is why it did not work the way you were trying. This is happening because, basically, the chained package's log was trying to overwrite the earlier created log (which was created by the main package).

In order to achieve what you want, you can take the value of the [MsiLogFileLocation] and store it in a public property, then create a script which will eliminate the log file name from the path ("msilog.txt") then assign the new value to another public property which you can further use in the "Log File:" field in the "Prerequisites" page -> chained package.

In order to achieve those said above, you can proceed as it follows:

- First we will have to set a public property to have the value of the [MsiLogFIleLocation] property (so we can further use it in our script, because we can only retrieve the values of public properties, meaning that we can not directly retrieve the value of [MsiLogFileLocation] property, since it is a private property). To do so, please go to "Dialogs" page --> click on "WelcomeDlg" dialog --> click on the "Next" button --> under "Published Events" click on "New..." to create an event as it follows:

Code: Select all

Event: Set installer property value
Property: MYLOGFILELOCATION (this name can be changed, as per your needs. Just make sure you are using only uppercase characters)
Argument: [MsiLogFileLocation]
Condition: leave unchanged. The default condition is "1" (or "AI_INSTALL")
- Now that we have assigned the value of the [MsiLogFileLocation] to a public property, it is time to create the script which will eliminate the log file name from the full path. To do so, please go to "Custom Actions" page and add a "PowerShellScriptInline" custom action without sequence. To add a custom action without sequence, simply press the "Add custom action without sequence" button which is place to the right side of the custom action's name. Now, under the "# Your code goes here." comment, please insert the following code:

Code: Select all

$logFile = AI_GetMsiProperty MYLOGFILELOCATION
$logFile = $logFile.Substring(0,$logFile.LastIndexOf('\'))
AI_SetMsiProperty MYNEWLOGFILELOCATION $logFile
Quick Note: The property names are just for the sake of the sample, you can change their names.

Explanation: The first line takes the value of the earlier created property ("[MYLOGFILELOCATION]") and stores it in the "$logFile" variable. The next line eliminates the log file name from the path (e.g. "F:\temp\msilog.txt" becomes "F:\temp"). The last line simply sets a new property to the new value of the "$logFile" variable. This new property will be further used to specify the log file location for your chained packages.

- Now that we have created the script, it is time to trigger it from a dialog control. To do so, please go to "Dialogs" page --> click on "WelcomeDlg" --> click on the "Next" button --> under "Published Events" tab, click on "New..." to create an event as it follows:

Code: Select all

Event: Execute custom action
Argument: PowerShellScriptInline
Condition: leave unchanged. The default condition is "1" (or "AI_INSTALL")
- Now the last step is to set the chained package log file location. To do so, please go to "Prerequisites" page --> click on your chained package --> and you can set the "Log File:" field as it follows:

Code: Select all

[MYNEWLOGFILELOCATION]\chainLog.txt
Hope this helps.

Also, attached is a sample project for your reference.
Krishna Sample Project.zip
(436.06 KiB) Downloaded 226 times
All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
nskris
Posts: 21
Joined: Fri Oct 26, 2018 3:32 pm

Re: Issues during Chain MSI install

Thankyou for helping out. One last question, is there a way to achieve this if we use basic UI setup? In that case, to which event i can bind the inline powershell script to?
Catalin
Posts: 6584
Joined: Wed Jun 13, 2018 7:49 am

Re: Issues during Chain MSI install

You are always welcome, Krishna.

I am glad I could help.

In what regards your question, since we are making use of the dialog controls, I am afraid that this is not possible during a basic/silent installation the way I have presented it above. During a basic/silent installation, the "Wizard Dialogs Stage" is skipped.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”