문제

I've created a custom MSI package and I'm working with Advanced Installer to try and add some sort of command line argument, a "flag" that can be triggered. When that flag is triggered, it will cause a chain of events to take place in the installer (delete certain files, move folders around, extract zip file... So on...)

In other words lets say I have my generated exe from Advanced Installer named installer.exe.

I want to, from a command line call installer.exe --triggerEvents which will trigger a chain of custom events within the installer itself..

After a bit of research I came across this very good article that pertains to my question:

How to Pass Command Line Arguments to MSI Installer Custom Actions

But it appears that the author is strictly focusing on MSI and not Advanced Installer, I would much rather take advantage of this application I'm using.

Would it be possible to simply call the installer by passing in whatever argument i want and grab it with a custom action by using the session? Or is there a method of doing this with AI?

도움이 되었습니까?

해결책

You should be able to create a public property within your MSI using AdvancedInstaller (Install Parameters page, Properties). Note that public properties must be ALL_CAPS while private properties can contain lower case letters.

Refer to the public property in your custom action(s) to retrieve the value of the property at runtime.

When invoking an msi from a command line you can set the value of a public property like this:

msiexec.exe /i "C:\MyAwesomeApp.msi" AWESOME_PROP="myValue"

From your description, it appears you are compiling your MSI into a bootstrapper. My understanding is that the bootstrapper exe will pass the arguments for a public property into the MSI on your behalf, ala:

C:\MyAwesomeApp.exe /i AWESOME_PROP="myValue"

I've found that it takes quite a bit of trial and error to get your custom actions to refer to the contents of a public property and to function the way that you want them to, but this is probably because I am not great at authoring MSI's. In my case, I've found building small, test installers as a proof of concept more or less helps me to debug what I'm trying to do. Once I get it right, I add that piece to the actual AIP file that I am working with and test there as well. Rinse and repeat as necessary!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top