FergusMurray
Posts: 150
Joined: Thu Sep 30, 2010 10:44 am

How to txt replace based on condition

Im looking for a solution to do file text replacement based on a condition, but i need this to run after the Edit XML file has happened

Essentially we have a base web.config
We apply the "Edit XML File" to update some of the values with ones entered on the dialogs at install time
I'd like to add another optional step that would replace all occurances of http:// with https:// if during install if the "Install to SSL" option has been checked

Any ideas how this can be achieved

Thanks,
Fergus.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: How to txt replace based on condition

Hi Fergus,

Instead of using the text update you can have a public property reference in the XML edit. Something like:

Code: Select all

[PROTOCOL]
Where the PROTOCOL property changes according to the specified condition.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
FergusMurray
Posts: 150
Joined: Thu Sep 30, 2010 10:44 am

Re: How to txt replace based on condition

I did consider that, but it would mean i would end up having to full define all the XML in the 10*web.config, and in reality that makes it a real pain to manage

If i do the text substitution in addition to defining the prototol used within the existing XML replacments that "should" work ok, and it shouldnt matter which way around the txt replace or xml edit happens
FergusMurray
Posts: 150
Joined: Thu Sep 30, 2010 10:44 am

Re: How to txt replace based on condition

I seem to have it almost working, just seem to have some issues getting the associated feature to install

I have a combobox on my dialog containing control data values:
http
https
I have the control property set to a property APERTAIIS_PROTOCOL (which I initialise in install parameters to: http)
I have set up a feature to "instaled based on condition": APERTAIIS_PROTOCOL =https <---- do i need double quotes???
and added my text replacement to that feature

but running the install and setting the control to https, didnt active the feature
I change the feature condition to: https=https and it installs ok and does the substitutions

Install log excerts from selecting https and it not putting the feature on, the associated condition based feature is named: Https

MSI (c) (34:90) [11:04:28:558]: PROPERTY CHANGE: Modifying APERTAIIS_PROTOCOL property. Its current value is 'http'. Its new value: 'https'.
..
MSI (s) (C0:E4) [11:04:35:307]: PROPERTY CHANGE: Modifying APERTAIIS_PROTOCOL property. Its current value is 'http'. Its new value: 'https'.
..
MSI (s) (C0:E4) [11:04:36:419]: Component: APERTAIIS_PROTOCOL; Installed: Absent; Request: Local; Action: Local
..
MSI (s) (C0:E4) [11:04:36:414]: Feature: Https; Installed: Absent; Request: Null; Action: Null
..
MSI (s) (C0:E4) [11:06:06:583]: Executing op: RegAddValue(Name=APERTAIIS_PROTOCOL,Value=https,)
WriteRegistryValues: Key: \Software\Aperta\Aperta Document Archive, Name: APERTAIIS_PROTOCOL, Value: https
..
MSI (s) (C0:E4) [11:07:08:380]: Executing op: FeaturePublish(Feature=Https,Parent=MainFeature,Absent=3,Component=,UhIu4p10?Ht?8?*0897+S5_rnRHC?L$gbMbBQM7)
PublishFeatures: Feature: Https
FergusMurray
Posts: 150
Joined: Thu Sep 30, 2010 10:44 am

Re: How to txt replace based on condition

is this still the case: http://www.advancedinstaller.com/user-g ... ature.html
or can the features be set at UI time now?
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: How to txt replace based on condition

Hello,

I'm not sure I understand. There's the predefined CustomizeDlg dialog which is displayed when the user selects a custom setup. It allows the user to select which features will be installed and display the disk cost.
The article you attached can still be implemented if you need some custom behavior which is not supported by CustomizeDlg.

For more information you can follow the Organization page "Feature Properties" article.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
FergusMurray
Posts: 150
Joined: Thu Sep 30, 2010 10:44 am

Re: How to txt replace based on condition

its a custom dialog, that sets the property that is used to set the feature condition, so i guess i need to vbs it
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: How to txt replace based on condition

Hello,

If you need to install features based on a condition you have the following predefined options:
  • the condition includes UI installer public properties
    • use "AddLocal" or "Remove" control events before CustomizeDlg
    • use the above article to create your own custom dialog
  • the condition doesn't include UI installer public properties
    • use the feature's "Install based on condition" option in the Organization page
All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”