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

Update xml file on maintenance

Hello Everybody

I have been searching the knowledge base for quite a while and cannot work out an easy way to do this so i am hoping someone here may know.

(Basic msi project)

I have a dialog where the user enters a url, I place this value into a SERVERLOCATION property. Once the rest of the install dialogs are complete I write the SERVERLOCATION value to an XML file (config file) and also write it to the registry so it can be retrieved later.

On maintenance we allow the user to update this server url, so far i have got the SERVERLOCATION reading the value out of the registry so what the user sees is what they entered on install. However if they change this value i cant see how to make installshield write that value to xml file once more.

The xml file is in its own component etc, i have read items about having to reinstall the component but cant work out how this is done either (also not ideal as the xml file contains other values).

Anyone come across or solved something like this before - any help would be great.

Thanks Stuart
Labels (1)
0 Kudos
(10) Replies
TimStVCS
Level 7

Hello Stuart, have you tried the XML File Changes view under System Configuration in the Installation Designer? This is where I make my XML file changes.

Tim
0 Kudos
s_richardson
Level 3

Thanks a lot for the reply. I have tried that area as this is where i set the value on Install, however on Maintenance (modify) this is not executed again.

It feels like they have really improved the install side with the UI on 2009 but the Maintenance side is still in the "skilled users only\have days spare to work it out" box.
0 Kudos
TheTraveler
Level 8

We have the same problem and I believe the best solution is to read the value from the XML file first before copying or over writing the file. So after the copy phase, you can update both the registry and the XML file. You can do this by using the COM interface into XML functions. If you are not familiar on how to do this, here is a link that contains an example. Just to let you know, the example writes values to the XML file. In order to read the value in question, modify the line

oNode.attributes.getNamedItem("value").value = strValue;

-- to be --

strValue = oNode.attributes.getNamedItem("value").value;

Hope this helps...
0 Kudos
Reureu
Level 10

Hi,

If I consider the amount of threads about this topic, it seems that many people have troubles making XML file changes in maintenance mode.
The funny thing is that the INI file changes do work trouble-free in maintenance mode.

I use Installshield 2008, but it seems that Installshield 2009 has got the same problem.

I would like to know whether the Acresso people have some hint, as I haven't read any answer from them about this topic.



  • Is there any issue in Installshield which prevents XML file changes in maintenance mode?
  • If there is no issue, why are the INI file changes properly performed in maintenance mode?


Regards
0 Kudos
s_richardson
Level 3

Hi

In the end had I to change tact on this as i couldnt quite get it to work for me. This is the story of my install shield life unfortunately, spend hours\days trying to do something then realise so many other people have the same issue yet there is no obvious resolution. I wouldn't hold your breath on a quick answer from them or resolution.

Although I must say thanks to everyone who tried to help me
0 Kudos
Reureu
Level 10

Hi,

After fighting with Installshield 2008 a bit, a colleague found an interesting workaround which avoids manipulating XML files in an Installscript.

The rule is: the XML File Changes are only performed if a feature is installed or reinstalled!
Obviously, this rule is documented nowhere!

Bearing that in mind, you can implement a little workaround:
[LIST=1]
  • Pack the XML file (MyFile.xml) you want to update when performing a maintenance (change) in a component (Component_MyFile.xml).
  • Pack this component in a separate feature (Feature_Config).
  • All you need to do is force MSI to reinstall this feature (Feature_Config) when your setup is launched in Maintenance(change) mode.
  • Create a CustomAction (let's call it enforceFeatureReinstallation) which calls an installscript function of the same name.
  • Set the condition of this Custom Action to Installed AND _IsMaintenance="change"
  • Make sure you call your CustomAction (enforceFeatureReinstallation) from your UISequence.
  • The corresponding installscript function consists of adding the name of your feature to the REINSTALL property.

    function INT enforceFeatureReinstall (hMsi)
    STRING szTmp;
    NUMBER iLen;
    STRING szFeatureToReinstall;
    begin
    szFeatureToReinstall = "Feature_Config";

    // Get the content of the current REINSTALL property
    MsiGetProperty(hMsi, "REINSTALL", szTmp, iLen);

    // Add the szFeatureToReinstall string to the REINSTALL property
    if (szTmp == "") then
    szTmp = szFeatureToReinstall;
    else
    szTmp = szFeatureToReinstall + "," + szTmp;
    endif;

    MsiSetProperty(g_hMsi, "REINSTALL", szTmp);

    return ERROR_SUCCESS;
    end;




    Regards
  • 0 Kudos
    s_richardson
    Level 3

    Thanks for posting that its good knowledge, hopefully it will help others too.
    0 Kudos
    Reureu
    Level 10

    Cheers mate!

    Phew! That one kept me busy for a little while!
    0 Kudos
    virtualbry
    Level 4

    Yes, thanks! 🙂

    In our Basic MSI project, I did something similar using a vbscript CA:


    strFeatureToReinstall = "Feature_Config"
    strReinstall = Session.Property("REINSTALL")

    If strReinstall = "" then
    strReinstall = strFeatureToReinstall
    Else
    strReinstall = strReinstall + "," + strFeatureToReinstall
    End If

    Session.Property("REINSTALL") = strReinstall
    0 Kudos
    MichaelU
    Level 12 Flexeran
    Level 12 Flexeran

    I'm not sure how I missed this thread the first time around, but I wanted to mention a slight tweak to this approach that would avoid the custom code: the Reinstall control event. Of course, as a control event, that would only work when the dialog sequence was shown. Thus this may not be appropriate for all needs, but would probably be reasonable for cases where the user had to specify a new value in such a dialog.
    0 Kudos