diabeteman
Posts: 7
Joined: Fri Feb 18, 2011 2:06 pm

Full command line operation issues

Hello there,

NB: I'm kind of new to Advanced Installer so I might be talking crazy about some stuff, don't hesitate on telling me about it.

Preamble

I work for THALES EPM and my company chose AI to generate all the installation packages of the project I'm working on. I've been assigned the responsability to setup the MSI build process.

The project contains about 40 to 50 different software applications, each one with their installation package. And therefore different needs : prerequisites, files, shortcuts, registry keys/values, custom actions, etc. All the applications of the project are built through continuous integration on a Hudson server, and I'd like to integrate the MSI packaging in Hudson (fully automated builds triggered by Source Code Management events)

Considering all this, the .aip project files cannot be managed in the GUI version of advanced installer. All must be done from the command line interface by maintaining one Advanced Installer script for each application of the project. All applications must share the same .aip template.

My questions

I've set up a test run with this .aip template file:

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DOCUMENT Type="Advanced Installer" CreateVersion="8.0.2" version="8.0.2" Modules="professional" RootPath="." Language="en">
  <COMPONENT cid="caphyon.advinst.msicomp.MsiPropsComponent">
    <ROW Property="ALLUSERS" Value="2"/>
    <ROW Property="ARPCOMMENTS" Value="This installer database contains the logic and data required to install [|ProductName]." ValueLocId="*"/>
    <ROW Property="BannerBitmap" MultiBuildValue="DefaultBuild:banner_image.jpg" Type="1"/>
    <ROW Property="DialogBitmap" MultiBuildValue="DefaultBuild:dialog_image.jpg" Type="1"/>
    <ROW Property="Manufacturer" Value="My Company" ValueLocId="*"/>
    <ROW Property="ProductCode" Value="1033:{F9C7EAE6-D1A1-439A-8722-6BD86B067C24} " Type="16"/>
    <ROW Property="ProductLanguage" Value="1033"/>
    <ROW Property="ProductName" Value="My Product" ValueLocId="*"/>
    <ROW Property="ProductVersion" Value="1.0.0"/>
    <ROW Property="SecureCustomProperties" Value="OLDPRODUCTS;AI_NEWERPRODUCTFOUND"/>
    <ROW Property="UpgradeCode" Value="{F3E30318-2281-4AE5-8D00-4B68075A65CC}"/>
    <ROW Property="WindowsType9X" MultiBuildValue="DefaultBuild:Windows 9x/ME" ValueLocId="-"/>
    <ROW Property="WindowsType9XDisplay" MultiBuildValue="DefaultBuild:Windows 9x/ME" ValueLocId="-"/>
  </COMPONENT>
  <COMPONENT cid="caphyon.advinst.msicomp.BuildComponent">
    <ROW BuildKey="DefaultBuild" BuildName="DefaultBuild" BuildOrder="1" BuildType="0" PackageFolder="D:" PackageFileName="setup" Languages="en" InstallationType="4"/>
    <ATTRIBUTE name="CurrentBuild" value="DefaultBuild"/>
  </COMPONENT>
  <COMPONENT cid="caphyon.advinst.msicomp.DictionaryComponent">
    <ROW Path="<AI_DICTS>ui.ail"/>
    <ROW Path="<AI_DICTS>ui_en.ail"/>
  </COMPONENT>
  <COMPONENT cid="caphyon.advinst.msicomp.FragmentComponent">
    <ROW Fragment="CommonUI.aip" Path="<AI_FRAGS>CommonUI.aip"/>
    <ROW Fragment="FolderDlg.aip" Path="<AI_THEMES>classic\fragments\FolderDlg.aip"/>
    <ROW Fragment="SequenceDialogs.aip" Path="<AI_THEMES>classic\fragments\SequenceDialogs.aip"/>
    <ROW Fragment="Sequences.aip" Path="<AI_FRAGS>Sequences.aip"/>
    <ROW Fragment="StaticUIStrings.aip" Path="<AI_FRAGS>StaticUIStrings.aip"/>
    <ROW Fragment="UI.aip" Path="<AI_THEMES>classic\fragments\UI.aip"/>
    <ROW Fragment="Validation.aip" Path="<AI_FRAGS>Validation.aip"/>
  </COMPONENT>
  <COMPONENT cid="caphyon.advinst.msicomp.MsiBinaryComponent">
    <ROW Name="aicustact.dll" SourcePath="<AI_CUSTACTS>aicustact.dll"/>
    <ROW Name="banner_image.jpg" SourcePath="<AI_THEMES>classic\resources\banner-image.jpg"/>
    <ROW Name="dialog_image.jpg" SourcePath="<AI_THEMES>classic\resources\dialog-image.jpg"/>
  </COMPONENT>
  <COMPONENT cid="caphyon.advinst.msicomp.MsiControlComponent">
    <ATTRIBUTE name="FixedSizeBitmaps" value="0"/>
  </COMPONENT>
  <COMPONENT cid="caphyon.advinst.msicomp.MsiControlEventComponent">
    <ROW Dialog_="VerifyReadyDlg" Control_="Back" Event="NewDialog" Argument="FolderDlg" Condition="AI_INSTALL" Ordering="201"/>
    <ROW Dialog_="WelcomeDlg" Control_="Next" Event="NewDialog" Argument="FolderDlg" Condition="AI_INSTALL" Ordering="1"/>
    <ROW Dialog_="VerifyReadyDlg" Control_="Install" Event="EndDialog" Argument="Return" Condition="AI_INSTALL" Ordering="197"/>
    <ROW Dialog_="FolderDlg" Control_="Next" Event="NewDialog" Argument="VerifyReadyDlg" Condition="AI_INSTALL" Ordering="201"/>
    <ROW Dialog_="FolderDlg" Control_="Back" Event="NewDialog" Argument="WelcomeDlg" Condition="AI_INSTALL" Ordering="1"/>
    <ROW Dialog_="MaintenanceTypeDlg" Control_="Back" Event="NewDialog" Argument="MaintenanceWelcomeDlg" Condition="AI_MAINT" Ordering="1"/>
    <ROW Dialog_="MaintenanceWelcomeDlg" Control_="Next" Event="NewDialog" Argument="MaintenanceTypeDlg" Condition="AI_MAINT" Ordering="99"/>
    <ROW Dialog_="CustomizeDlg" Control_="Back" Event="NewDialog" Argument="MaintenanceTypeDlg" Condition="AI_MAINT" Ordering="1"/>
    <ROW Dialog_="MaintenanceTypeDlg" Control_="ChangeButton" Event="NewDialog" Argument="CustomizeDlg" Condition="AI_MAINT" Ordering="301"/>
    <ROW Dialog_="VerifyReadyDlg" Control_="Back" Event="NewDialog" Argument="CustomizeDlg" Condition="AI_MAINT" Ordering="202"/>
    <ROW Dialog_="CustomizeDlg" Control_="Next" Event="NewDialog" Argument="VerifyReadyDlg" Condition="AI_MAINT" Ordering="1"/>
    <ROW Dialog_="VerifyReadyDlg" Control_="Install" Event="EndDialog" Argument="Return" Condition="AI_MAINT" Ordering="198"/>
    <ROW Dialog_="VerifyReadyDlg" Control_="Back" Event="NewDialog" Argument="PatchWelcomeDlg" Condition="AI_PATCH" Ordering="203"/>
    <ROW Dialog_="PatchWelcomeDlg" Control_="Next" Event="NewDialog" Argument="VerifyReadyDlg" Condition="AI_PATCH" Ordering="201"/>
    <ROW Dialog_="VerifyReadyDlg" Control_="Install" Event="EndDialog" Argument="Return" Condition="AI_PATCH" Ordering="199"/>
    <ROW Dialog_="ResumeDlg" Control_="Install" Event="EndDialog" Argument="Return" Condition="AI_RESUME" Ordering="299"/>
  </COMPONENT>
  <COMPONENT cid="caphyon.advinst.msicomp.MsiCustActComponent">
    <ROW Action="AI_DOWNGRADE" Type="19" Target="4010"/>
    <ROW Action="AI_PREPARE_UPGRADE" Type="65" Source="aicustact.dll" Target="PrepareUpgrade"/>
    <ROW Action="AI_RESTORE_LOCATION" Type="65" Source="aicustact.dll" Target="RestoreLocation"/>
    <ROW Action="AI_ResolveKnownFolders" Type="1" Source="aicustact.dll" Target="AI_ResolveKnownFolders"/>
    <ROW Action="AI_STORE_LOCATION" Type="51" Source="ARPINSTALLLOCATION" Target="[APPDIR]"/>
    <ROW Action="SET_APPDIR" Type="307" Source="APPDIR" Target="[ProgramFilesFolder][Manufacturer]\[ProductName]"/>
    <ROW Action="SET_SHORTCUTDIR" Type="307" Source="SHORTCUTDIR" Target="[ProgramMenuFolder][ProductName]"/>
    <ROW Action="SET_TARGETDIR_TO_APPDIR" Type="51" Source="TARGETDIR" Target="[APPDIR]"/>
  </COMPONENT>
  <COMPONENT cid="caphyon.advinst.msicomp.MsiInstExSeqComponent">
    <ROW Action="AI_DOWNGRADE" Condition="AI_NEWERPRODUCTFOUND AND (UILevel <> 5)" Sequence="210"/>
    <ROW Action="AI_RESTORE_LOCATION" Condition="APPDIR=""" Sequence="749"/>
    <ROW Action="AI_STORE_LOCATION" Condition="Not Installed" Sequence="1501"/>
    <ROW Action="AI_PREPARE_UPGRADE" Condition="AI_UPGRADE="No" AND (Not Installed)" Sequence="1399"/>
    <ROW Action="AI_ResolveKnownFolders" Sequence="51"/>
  </COMPONENT>
  <COMPONENT cid="caphyon.advinst.msicomp.MsiInstallUISequenceComponent">
    <ROW Action="AI_RESTORE_LOCATION" Condition="APPDIR=""" Sequence="749"/>
    <ROW Action="AI_ResolveKnownFolders" Sequence="51"/>
  </COMPONENT>
  <COMPONENT cid="caphyon.advinst.msicomp.MsiLaunchConditionsComponent">
    <ROW Condition="VersionNT" Description="[ProductName] cannot be installed on [WindowsType9XDisplay]" DescriptionLocId="AI.LaunchCondition.No9X" IsPredefined="true" Builds="DefaultBuild"/>
  </COMPONENT>
  <COMPONENT cid="caphyon.advinst.msicomp.MsiThemeComponent">
    <ATTRIBUTE name="UsedTheme" value="classic"/>
  </COMPONENT>
  <COMPONENT cid="caphyon.advinst.msicomp.MsiUpgradeComponent">
    <ROW UpgradeCode="[|UpgradeCode]" VersionMax="[|ProductVersion]" Attributes="1025" ActionProperty="OLDPRODUCTS"/>
    <ROW UpgradeCode="[|UpgradeCode]" VersionMin="[|ProductVersion]" Attributes="2" ActionProperty="AI_NEWERPRODUCTFOUND"/>
  </COMPONENT>
</DOCUMENT>
And this script:

Code: Select all

;aic
SetProperty Company="Thales"
SetProperty Division="EPM"
SetProperty Manufacturer="My Project Name"
SetProperty TARGETDIR="C:\[|Manufacturer]\[|Company]"
SetProperty AI_PRODUCTNAME_ARP="[|Manufacturer] - [|ProductName] [|ProductVersion]"
SetProperty ARPCONTACT="support.myproject@thalesgroup.com"
SetProperty ARPHELPLINK="http://my.help.url"
SetProperty ARPHELPTELEPHONE="+33 1 00 00 00 00"
SetProperty ARPPRODUCTICON="C:\full\path\to\app\icon.ico"
SetProperty ARPURLINFOABOUT="http://my.about.url"
SetBitmap -banner D:\resources\images\banner-image.bmp -dialog D:\full\path\to\dialog-image.bmp
SetProperty ProductName="SomeProduct"
SetProperty BuildNumber="20110218125422"
SetVersion 2.8.0 -noprodcode
AddFolder APPDIR\[|ProductName] D:\work_dir\package\doc
AddFolder APPDIR\[|ProductName] D:\work_dir\package\examples
AddFolder APPDIR\[|ProductName] D:\work_dir\package\source
AddFile APPDIR\[|ProductName] D:\work_dir\package\some_script.pl
AddFile APPDIR\[|ProductName] D:\work_dir\package\README.txt
AddFile APPDIR\[|ProductName] D:\work_dir\package\myproduct.exe
AddFile APPDIR\[|ProductName] D:\work_dir\package\myproduct-debug.exe
NewShortcut -name "My Product User Manual" -dir SHORTCUTDIR -target APPDIR\doc\myproduct-manual.pdf -icon D:\resources\icons\PDFFile.ico -mode normal
NewShortcut -name "My Product README" -dir SHORTCUTDIR -target APPDIR\README.txt -icon D:\resources\icons\PDFFile.ico -mode normal
NewReg -RegValue HKLM\Software\[Company]\[Division]\[Manufacturer]\[ProductName]\ProductVersion -data #%[ProductVersion]
NewReg -RegValue HKLM\Software\[Company]\[Division]\[Manufacturer]\[ProductName]\BuildNumber -data #%[BuildNumber]
SetPackageName D:\work_dir\myproduct-2.8.0.20110218125422.msi
ReBuild
Which, when ran from the command line, gives me this:

Code: Select all

AdvancedInstaller.com /execute D:\work_dir\global_template.aip D:\work_dir\advancedinstaller.script

SetProperty Company="My Company"
SetProperty Division="My Division"
SetProperty Manufacturer="My Project Name"
SetProperty TARGETDIR="C:\[|Manufacturer]\[|Company]"
SetProperty AI_PRODUCTNAME_ARP="[|Manufacturer] - [|ProductName] [|ProductVersion]"
SetProperty ARPCONTACT="support@mycompany.com"
SetProperty ARPHELPLINK="http://my.help.url"
SetProperty ARPHELPTELEPHONE="+33 1 00 00 00 00"
SetProperty ARPPRODUCTICON="C:\full\path\to\app\icon.ico"
SetProperty ARPURLINFOABOUT="http://my.about.url"
SetBitmap -banner D:\resources\images\banner-image.bmp -dialog D:\full\path\to\dialog-image.bmp
SetProperty ProductName="MyProduct"
SetProperty BuildNumber="20110218125422"
SetVersion 2.8.0 -noprodcode
AddFolder APPDIR\[|ProductName] D:\work_dir\package\doc
AddFolder APPDIR\[|ProductName] D:\work_dir\package\examples
AddFolder APPDIR\[|ProductName] D:\work_dir\package\source
AddFile APPDIR\[|ProductName] D:\work_dir\package\some_script.pl
AddFile APPDIR\[|ProductName] D:\work_dir\package\README.txt
AddFile APPDIR\[|ProductName] D:\work_dir\package\myproduct.exe
AddFile APPDIR\[|ProductName] D:\work_dir\package\myproduct-debug.exe
NewShortcut -name "My Product User Manual" -dir SHORTCUTDIR -target APPDIR\doc\myproduct-manual.pdf -icon D:\resources\icons\PDFFile.ico -mode normal
NewShortcut -name "My Product README" -dir SHORTCUTDIR -target APPDIR\README.txt -icon D:\resources\icons\PDFFile.ico -mode normal
NewReg -RegValue HKLM\Software\[Company]\[Division]\[Manufacturer]\[ProductName]\ProductVersion -data #%[ProductVersion]
NewReg -RegValue HKLM\Software\[Company]\[Division]\[Manufacturer]\[ProductName]\BuildNumber -data #%[BuildNumber]
SetPackageName D:\work_dir\myproduct-2.8.0.20110218125422.msi
ReBuild
[ DefaultBuild ]

Building package (en): D:\work_dir\myproduct-2.8.0.20110218125422.msi
Creating CAB file(s)... done.
Creating MSI database... done.
Inserting CAB file(s) into MSI... done.
Writing Summary Information... done.
Build time: 1 sec.


Total build time: 1 sec.
Build finished successfully.
When I double click on the generated msi package, files are copied to the right location, registry keys and values are created but the shortcuts are not created (only their containing folder in the start menu...).
  • How do I change the shortcut creation location to : [ProgramMenuFolder][Manufacturer]\[ProductName] instead of the default value [ProgramMenuFolder][ProductName] ?
  • Instead of adding every file and folder separately, can I just tell AI to take everything from some location and put it in the APPDIR ?
  • How do I add custom actions from the command line ?
Thanks in advance for your help,
Robin
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Full command line operation issues

Hi Robin,
but the shortcuts are not created
This could happen if their targets are not installed on the machine. If you created external shortcuts you need to make sure they are all having their target starting with a property.
otherwise they will not install.
How do I change the shortcut creation location to : [ProgramMenuFolder][Manufacturer]\[ProductName] instead of the default value [ProgramMenuFolder][ProductName] ?
You will need to change the default value of "SHORTCUTDIR", you can try the same method as the one used for TARGETDIR or by setting this default value from the beginning, when you create the project in the GUI of Advanced Installer.
Instead of adding every file and folder separately, can I just tell AI to take everything from some location and put it in the APPDIR ?
For this you can try our synchronization feature.
How do I add custom actions from the command line ?
I'm afraid this is not possible in the current version of Windows Installer.

Please note that handling about 40 projects only from CLI is very hard, because not all options available in GUI of Advanced Installer can be used from the command line too.
Also, incorrect settings in the project are easier to detect from the GUI. I recommend you have an alternative option which allows you to use the GUI too, in case the CLI does not offer you all the options you need.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
diabeteman
Posts: 7
Joined: Fri Feb 18, 2011 2:06 pm

Re: Full command line operation issues

Bogdan wrote:This could happen if their targets are not installed on the machine. If you created external shortcuts you need to make sure they are all having their target starting with a property.
otherwise they will not install.
Maybe I did give the wrong path in TARGET. The thing is I'm not shure with the value of APPDIR. Is it equal to TARGETDIR ?
You will need to change the default value of "SHORTCUTDIR", you can try the same method as the one used for TARGETDIR or by setting this default value from the beginning, when you create the project in the GUI of Advanced Installer.
I tried that. I added another line in the script :

Code: Select all

SetProperty SHORTCUTDIR="[ProgramMenuFolder][|Manufacturer]\[|ProductName]"
Before the lines where I create the shortcuts :

Code: Select all

NewShortcut -name "Product User Manual" -dir SHORTCUTDIR -target APPDIR\doc\product-manual.pdf -icon D:\resources\icons\PDFFile.ico -mode normal
NewShortcut -name "Product README" -dir SHORTCUTDIR -target APPDIR\README.txt -icon D:\resources\icons\PDFFile.ico -mode normal
When I launch the MSI, I get an error :

Code: Select all

Could not access network location [ProgramMenuFolder]Manufacturer\MyProduct
Why is the variable [ProgramMenuFolder] not resolved ?
For this you can try our synchronization feature.
Can you use environment variables in the sourcedir for a synchronized folder ? The location of the source files will be variable and cannot be hard set in the GUI.
I recommend you have an alternative option which allows you to use the GUI too, in case the CLI does not offer you all the options you need.
Ok for the overall behaviour of the MSI. Like custom actions and stuff. But not for shortcuts, registry, files creation/addition. Do you think I can manage to do that ?

Thanks for the quick response :-)
Robin
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Full command line operation issues

Hello Robin,
The thing is I'm not shure with the value of APPDIR. Is it equal to TARGETDIR ?
Yes, it is. The APPDIR is an Advanced Installer property based folder who's value is assigned to the TARGETDIR property.
Why is the variable [ProgramMenuFolder] not resolved ?
The ProgramMenuFolder property is resolved according with the target machine after the CostFinalize standard action when running the package. It is not resolved during the build time. I noticed you were using both pseudo-formatted and formatted values when referencing your path. Please note that pseudo-formatted references are resolved at build time whereas formatted references are resolved during run time.
Can you use environment variables in the sourcedir for a synchronized folder ? The location of the source files will be variable and cannot be hard set in the GUI.
You can try to use our "Path Variables" feature to define a path variable for your synchronized folder's path. The path variable's value can contain reference to an environment variable.
Ok for the overall behaviour of the MSI. Like custom actions and stuff. But not for shortcuts, registry, files creation/addition. Do you think I can manage to do that ?
This completely depends on the future settings you will need for your project but the command line doesn't cover the whole configuration of the project's available functionality like the GUI does. Specifically for shortcuts, registry, files creation/addition, we have a basic configuration available from the command line but for a more detailed approach you will have to use the GUI. Here is a complete article from our user guide of all available Advanced Installer setting commands.

Best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
diabeteman
Posts: 7
Joined: Fri Feb 18, 2011 2:06 pm

Re: Full command line operation issues

mihai.petcu wrote:
Why is the variable [ProgramMenuFolder] not resolved ?
The ProgramMenuFolder property is resolved according with the target machine after the CostFinalize standard action when running the package. It is not resolved during the build time. I noticed you were using both pseudo-formatted and formatted values when referencing your path. Please note that pseudo-formatted references are resolved at build time whereas formatted references are resolved during run time.
Yep, I already knew about the "pseudo-formatted" and "formated" properties resolution at build time or execution time. This is exactly why I used "pseudo-formatted" properties for the folders I didn't want changed. And a "formatted" property for [ProgramMenuFolder] so that it is resolved when running the package.

But this doesn't tell me why the formatted property [ProgramMenuFolder] is not resolved by windows installer during the CostFinalize action.

Can you help me on this ?

thanks
Robin
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Full command line operation issues

Hi Robin,
But this doesn't tell me why the formatted property [ProgramMenuFolder] is not resolved by windows installer during the CostFinalize action.
You cannot set a property with a formatted reference to another property. This can be done only by scheduling a "Property Set with Formatted" custom action after the CostFinalize standard action.

Best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
diabeteman
Posts: 7
Joined: Fri Feb 18, 2011 2:06 pm

Re: Full command line operation issues

mihai.petcu wrote:Hi Robin,
But this doesn't tell me why the formatted property [ProgramMenuFolder] is not resolved by windows installer during the CostFinalize action.
You cannot set a property with a formatted reference to another property. This can be done only by scheduling a "Property Set with Formatted" custom action after the CostFinalize standard action.

Best,
Mihai
Ok I'm starting to understand the process.

How can I specify exactly where my custom action will be executed ?
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Full command line operation issues

Hello Robin,
How can I specify exactly where my custom action will be executed ?
You can schedule your custom action from the Custom Actions Page.

Just right click on "InstallUISequence" -> "Show standard action..." -> "CostFinalize". After doing so you will see the CostFinalize standard action in the Install Sequence tree. Right click it -> "New Custom Action" -> "Property set with Formatted". Add the CostFinalize standard action from the "InstallExecuteSequence" -> "Before Initialization" in the same manner. After this, you should share the custom action between the InstallUISequence and the InstallExecuteSequence. Simply drag the custom action from one sequence to the other, while pressing the Shift key. This way the custom action will run either when running the package silently or when running with full UI.

You should also add this execution condition to your custom action:

Code: Select all

NOT Installed
This way your custom action will be executed only during the install process.

To understand how custom actions work you may also want to take a look at this article from our user guide.

Best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
diabeteman
Posts: 7
Joined: Fri Feb 18, 2011 2:06 pm

Re: Full command line operation issues

Thank you for your help :D
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Full command line operation issues

You're welcome, glad to assist.

Best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”