We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

o.p.davey
Posts: 6
Joined: Fri Jul 11, 2014 9:58 am

Importing XML with [APPDIR] references from command line

Hi, I'm in the process of creating an installer that integrates with an automated build process. There are a number of XML files which need to be included but these contain references to the install location. An XML file may contain "C:\Program Files\OurApp\run.exe" and I am looking for a way to get this to point to "run.exe" in whatever APPDIR is chosen at install time. Since the build process is automated, new XML files may be added and importing each of these before opening AI and manually editting the XML to use "[APPDIR]run.exe" can take a while (~10 cases per file with upwards of 20 files atm).

So far I have identified 2 approaches to my goal (neither of which I know enough about AI to actually do), but there may well be other ways to do so. I'm just looking for any way that works, really.

1. Edit all of the XML files beforehand to replace "C:\Program Files\OurApp\" with some string that will get interpreted as the variable [APPDIR] on import

2. Import XML files and use an "EditXML" command from the command line to change all of these instances to [APPDIR] (Not really sure if this is even supported)

Any advice would be greatly appreciated. If any part of my situation is unclear, I will gladly provide more information.

Thanks!
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Importing XML with [APPDIR] references from command line

Hi and welcome to Advanced Installer forums.

In order to achieve what you want you can follow the steps below:
- create a "Text File Update" operation in the same folder where your XML files are located
- set its name to "*.xml" (perform the next step before setting this name)
- in the "File Content" field from the "Appent/Create" section write a non-existent property (i.e. [empty]) and uncheck the "Create file with encoding" option
- in the "Replace" section set the content that you want to find and replace in your XML files
- go in the "Table Editor" page, "InstallExecutionSequence" table and set the "Sequence" value of the "AI_TxtUpdaterInstall" row to "5104"
- build and run the project

By performing the above steps all the XML files that are found in the folder where the "Text File Update" operation was created, will be modified according to the options you set for that operation.

Let us know if this helped, otherwise give us more details about your scenario.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
o.p.davey
Posts: 6
Joined: Fri Jul 11, 2014 9:58 am

Re: Importing XML with [APPDIR] references from command line

Hi, sorry for the delay in replying to you.

I looked into the advice you gave, but I should have specified earlier that the product which contains the XML files is a merge module, and the "Update Text File" operation is not available.

Here's a more detailed picture of the situation:

-We have product A which is required for product B, but product A can also be deployed standalone.
-There is a merge module (MM) for product A
-The XML files are part of MM
-Product B includes MM, some addition (non-core) files from product A, and it's own files.

If you need any more info, just ask (I wrote a longer reply before my PC crashed)

Thanks
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Importing XML with [APPDIR] references from command line

Hi,

Indeed, the "Text File Update" operation is not available in a merge module project.

However, you can create this operation in the main project (A or B), that contain the merge module. If necessary, you can set a greater value for the "Sequence" field of the "AI_TxtUpdaterInstall" action, as I mentioned in my previous post.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
o.p.davey
Posts: 6
Joined: Fri Jul 11, 2014 9:58 am

Re: Importing XML with [APPDIR] references from command line

In the "Files and Folders", the button "Text File update" is greyed-out and I cannot click it. The "XML File" button close to it in the "New" section of the ribbon is too, if that helps narrow down the current state. I tried creating a new installer, adding just a .txt file and highlighting it, but I still cannot click the "Text File Update" button.
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Importing XML with [APPDIR] references from command line

Hi,

This may happen if you use a project type that does not include this feature. The "Text File Update" feature is available only in an " Enterprise" or higher project type.

To check this, you can go to "Home -> Options -> Project Type" tab.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
o.p.davey
Posts: 6
Joined: Fri Jul 11, 2014 9:58 am

Re: Importing XML with [APPDIR] references from command line

Ok, I've done that and it looks like it'll work a treat. (I haven't fully tested it yet as the text to replace is very slightly different in each xml file) Once these are updated, however, it looks trivial to duplicate this for the other installer. Thanks for your help. It's much appreciated!
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Importing XML with [APPDIR] references from command line

You're welcome. Glad to help.

Just let me know if any other problem appears.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
o.p.davey
Posts: 6
Joined: Fri Jul 11, 2014 9:58 am

Re: Importing XML with [APPDIR] references from command line

Ok, I've tested this out and it works great. A side-effect is that it produced a lot of .back files. I managed to resolve this like so: (In case someone else finds themselves in the same situation)
I added a "File Removal" file operation in the same directory with the name "*.back". In the table editor, in the table "InstallExecuteSequence" I set the "Sequence" field of "RemoveFiles" to 6505.

Thanks for all your assisstance.
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Importing XML with [APPDIR] references from command line

You're welcome. I'm glad you got this working.

The way you removed the created backup files is correct. Also, when you create a "Text File Update" operation or an "XML Update" operation, you have the option to disable the creation of these files by unchecking the "Backup file before performing update" option.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”