cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
beckett
Level 3

Changing values in XML file

I have an app.config file which I need too change some values in.
I have read the section in the helpfile called:
Using InstallScript Text Substitution to Dynamically Modify XML Files
But I cannot get this to work. I created an entry in the string table called:
ID_AUTOMATIC_FLAG and set it to True.

In the XML File Changes view I then go to the element properties advanced tab and try and reference this with , this ends up changing to {ID_STRING50}
In my script I then use
TextSubSetValue(@ID_AUTOMATIC_FLAG, "False", TRUE);

The substitution in my xml file always ends up with something like
<ID_AUTOMATIC_FLAG>

I have also tried this syntax
TextSubSetValue(, "False", TRUE);
but that does not appear to work either

Could someone clarify how this is supposed to work, the main problem appears to be in setting the element content, it does not appear to recognise the string table value, I have tried numerous variations, enclosing it in quaotes, using [] brackets but nothing seems to work.
Labels (1)
0 Kudos
(3) Replies
DebbieL
Level 17

Have you tried this?
TextSubSetValue("", "False", TRUE);

(where the first parameter is in quotes?)
0 Kudos
beckett
Level 3

Hi,

I had tried the quotes without success, if I debug the package I can see the script reach the line:
TextSubSetValue("","MyValue",TRUE);
But the value in the xml file never changes.

If I look at the set element content property in the advanced tab of the XML Element you can see:
{MyProperty}False

But the value in the file never changes, even though if I debug the script I can see the line TextSubSetValue("","MyValue",TRUE); being called. I know at the point that the line is called the file modification date changes, it just does not put the new value in the file.
0 Kudos
DebbieL
Level 17

Where in your code are you calling TextSubSetValue? Is it possible that your code is being called before the XML file is installed on the target system?

A common place for the TextSubSetValue call is the OnFirstUIBefore event.
0 Kudos