sbrown_el
Posts: 20
Joined: Wed Dec 05, 2012 4:07 pm

dynamic reference to file for custom action

As part of our installer we need to include another MSI that the application builds, and run it as part of the install custom action. As we're using TFS to manage the build, there is no static name for the location of the MSI we need to inclulde (or for that matter, any file we need to include).

To get around this, I've defined a <Source> path variable as a relative path to the AIP file, and updated the XML directly (I couldn't get AI to leave the reference as a relative path) to reference the files in the installer build to reference this path. AI picks up all the necessary files for the app just fine... except for two:
  • The icon file for the setup.exe
    the MSI file produced from the application build.
I can hard code a reference to the icon (but I'd prefer not to) - however the MSI is specific to a given version of the code. The Custom action has the following line in the XML

Code: Select all

    <ROW Action="COMPLUS.msi" Type="23" Source="<Source>\Temp\COMPLUS.msi" Target="REMOTESERVERNAME=[APP_SERVER]"/>
When the build runs, I get an error out, specifying that it couldn't find the file

Code: Select all

Could not copy file from '<Source>\Temp\COMPLUS.msi' to 'C:\OUT\Installer\Output\COMPLUS.msi'. Error: The filename, directory name, or volume label syntax is incorrect.
The file source is there....

Code: Select all

 Volume in drive E is LOCAL_VMFS_E_APPS
 Volume Serial Number is 72EB-003F

 Directory of E:\Builds\1\Development\M0711.System.Core.Manual\Binaries\Src\Temp

01/28/2013  10:05 AM         3,699,712 COMplus.msi
               1 File(s)      3,699,712 bytes
               0 Dir(s)  104,660,275,200 bytes free

however, it would seem AI isnt expanding the path for the source of the file to copy....

Or is this an unsupported action???

Thanks
Bogdan
Posts: 2791
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: dynamic reference to file for custom action

Hi,

First of all, you should know that launching an MSI for install with a custom action is not recommended because Windows Installer does not
accept to install two packages on the same time. For this we provide a much cleaner support, the feature-based prerequisites.

All you need to do is to add your EXE as a feature-based prerequisite, add all its referred files next to it, and Advanced Installer will build
a main MSI file that installs your application and this prerequisite.

The prerequisite needs a static source for the prerequisite that will be included in the project. For this you can use our pre-build events support
from Media page to copy the files required from the location generated by TFS in the static folder from where Advanced Installer will pick them up
and include in the main package.

In what regards the manual changes performed on path variables I recommend reverting them all, or if you have a copy of the aip file before you
did those changes better start again from that. Manual changes in the project are often the source for incorrect package behavior, and we cannot always track the
problem. Since you have another much cleaner option(explained above) I recommend to revert all the changes mentioned below.

Best regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sbrown_el
Posts: 20
Joined: Wed Dec 05, 2012 4:07 pm

Re: dynamic reference to file for custom action

Bogdan wrote:Hi,

First of all, you should know that launching an MSI for install with a custom action is not recommended because Windows Installer does not
accept to install two packages on the same time. For this we provide a much cleaner support, the feature-based prerequisites.
We have a functioning install based on static directory structures, complete with uninstall - we're just trying to incorporate this into the dynamic environment of the TFS build server now. We have built appropriate logic to handle the second MSI as a secondary install package using custom actions.
Bogdan wrote: All you need to do is to add your EXE as a feature-based prerequisite, add all its referred files next to it, and Advanced Installer will build
a main MSI file that installs your application and this prerequisite.
Unfortunately, the MSI contains references to the DLLs being installed as part of the main AI install package, thus the COMPlus install must occur as a post install step.
Bogdan wrote: The prerequisite needs a static source for the prerequisite that will be included in the project. For this you can use our pre-build events support
from Media page to copy the files required from the location generated by TFS in the static folder from where Advanced Installer will pick them up
and include in the main package.
That's unrealistic in a TFS based environment where multiple builds are occuring on a build server at the same time - EVERYTHING needs to be contained within the build root folder, thus the build path needs to be dynamic, or as I've coded, relative to the AIP file.
Bogdan wrote: In what regards the manual changes performed on path variables I recommend reverting them all, or if you have a copy of the aip file before you
did those changes better start again from that. Manual changes in the project are often the source for incorrect package behavior, and we cannot always track the
problem. Since you have another much cleaner option(explained above) I recommend to revert all the changes mentioned below.

Best regards,
Bogdan
The GUI and command line would not perform the changes required to accept the relative paths...it kept forcing back absolute paths, which can not exist in a TFS environment. My only option was direct editing of the XML, setting ...

Code: Select all

<DOCUMENT Type="Advanced Installer" CreateVersion="9.7" version="9.8" Modules="enterprise" RootPath="..\..\Binaries\buildbase" .....

Code: Select all

  <COMPONENT cid="caphyon.advinst.msicomp.AppPathsComponent">
    <ROW Name="Source" Path="..\..\Binaries\buildbase" Type="2" Content="0"/>
  </COMPONENT>
and then referencing all files (other than the two that I've mentioned) as

Code: Select all

    ..... SourcePath="<Source>\APPLICATION\filename.ext" ....
If we have to limit ourselves to hard coded paths for everything, then we limit ourselves to a single build execution on the build server...

Any other suggestions?
Bogdan
Posts: 2791
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: dynamic reference to file for custom action

Hi,
Unfortunately, the MSI contains references to the DLLs being installed as part of the main AI install package, thus the COMPlus install must occur as a post install step.
We also have support for post-install prerequisites in the latest version of Advanced Installer, which I see you have. So you can try that too.
it kept forcing back absolute paths
That is correct, it forces you to specify a full path when creating the path variable, but if that path is relative to the aip file, Advanced Installer detects it and saves it as
relative in the project. I just tested this and can confirm. So you don't need to manually edit the aip file at all, just use the standard method to define and use the path variable.

Best regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”