Edit XML Per Build Configuration - Advanced Installer Community
mikebei
Posts: 6
Joined: Mon Feb 01, 2016 3:47 pm

Edit XML Per Build Configuration

I have a handful of different web installer build configurations that I would like to each have modify an XML file. Each should update the same XML file and the same node value, but setting it to a different value.

Aside from this single XML edit, these builds are all identical. Since the application is fairly large, each build configuration is set to download the same .msi file to use during installation.

I have set up a custom install parameter and have overridden the value of the parameter to be specific to each build configuation. For editing the XML file, I have set up my installer project to use the value of that parameter when updating the XML. The problem is, it seems that value gets hard-coded into the msi file. The result of this is that the last build configuration to be run sets the XML value to what it needs, but then all of the web installers end up with that same value being inserted into the XML since they all install from the same msi file.

How can I make updates to an XML file using values associated with the web installer's bootstrapper exe instead of having it hard-coded into the underlying msi?
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Edit XML Per Build Configuration

Hello and welcome to Advanced Installer forums,

Please note that when you create a property in the in the Install Parameters view you can specify the property's value for each build in the project. Note that the options bellow, appear in the “Edit Property” dialog only if the project features multiple builds.

This way, the property will have different values based on the build.

Please let me know if that helped, otherwise give me more details about your scenario.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mikebei
Posts: 6
Joined: Mon Feb 01, 2016 3:47 pm

Re: Edit XML Per Build Configuration

Hi Dan,

I think I need to provide clearer details, as I had already set the per-build property values as you mention. I've included some screenshots with the relevant information regarding two different build configurations.

Here's the property value being set differently per-build:
Property screens
Property screens
Property_Screen.png (12.37 KiB) Viewed 3451 times
Here's where I'm using the values specified per-build to update an xml file:
XML screen
XML screen
XML_Editor.png (18.79 KiB) Viewed 3451 times
Here's what the actual build configurations look like:
Build configuration screens
Build configuration screens
Build_Screen.png (47.7 KiB) Viewed 3451 times
Note in particular that the two build configurations have differently named .exe files, but identically named .msi files. The same .msi file is intended to be used by both and both .exe bootstrappers download the .msi from the same URL.

So what happens is that since both build configurations have the same name for .msi output, if I build both configurations, one build will overwrite the .msi for the other. This isn't a problem, as the .msi should be identical. But after uploading the .msi and running the installers, whichever build created the final .msi file is the build that the property value is pulled from. So if "Standard" build runs first, then "Connect" build overwrites the msi, the value inserted into the XML is always "Connect", even if I'm running the .exe bootstrapper produced by the "Standard" build. Vise-versa is true if I build them in the reverse order.

To me, this makes it seem as though the build-specific property value gets set in the .msi at the time that the .msi file is created, not at the time that the bootstrapper executes the downloaded .msi. I need to be able to have that property value change when the bootsrapper is actually run, not when it's generated.

How can I accomplish this? Do you need other details of my project?

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

Re: Edit XML Per Build Configuration

Hi,

I apologize for the delayed reply.
To me, this makes it seem as though the build-specific property value gets set in the .msi at the time that the .msi file is created, not at the time that the bootstrapper executes the downloaded .msi. I need to be able to have that property value change when the bootsrapper is actually run, not when it's generated.
Indeed, the properties with their build-specific values are written in the MSI packages at build-time, not in the bootstrapper. Each bootstrapper build has its own MSI package, but if you use the same MSI package for all the bootstrapper builds, they will use the same value for the properties.

In order to set the value of a property based on the launched bootstrapper you can go in the "Custom Actions" page and create a "Set installer property" custom action for each build after the "Install Execution Stage -> Searches" action group as in the example below:
  • Property: PlayerType
    Value: Connect
    Condition: AI_SETUPEXEPATH >> "ConnectSetup.exe"
    (TRUE if left string ends with the right string)
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
mikebei
Posts: 6
Joined: Mon Feb 01, 2016 3:47 pm

Re: Edit XML Per Build Configuration

Success!

While this feels like kind of a clunky workaround since I figured the bootstrapper would just execute the msi package through msiexec and pass in the parameter values at that point, I'm happy to use this solution and move on with my project.

Thanks for your help!

Return to “Building Installers”