cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Not applicable

duplicate xml node after upgrading

Hi.

We have a product where a xml contains, among other things licensekeys for different modules.

The node only have one property, Licensekey with the value [LICENSEKEY]

The xpath (Element name) is "add[licensekey=[LICENSEKEY]]"

When running a update the element is not found and a duplicate node is created, despite the same node is already present.

It is only a problem in the xml elements where the the element name contains a property.

From the msi log.
Processing XPath '//'
InstallShield 13:55:59: Processing XPath '//CompanyLicense'
InstallShield 13:55:59: Processing XPath '//CompanyLicense/licenses'
InstallShield 13:55:59: Processing XPath '//CompanyLicense/licenses/add[licensekey=[LICENSEKEY]]'
InstallShield 13:55:59: XPath '//CompanyLicense/licenses/add[licensekey=[LICENSEKEY]]' not found, creating
InstallShield 13:55:59: Checking XPath 'CompanyLicense/licenses'
InstallShield 13:55:59: Creating element: Name=add, Namespace=
InstallShield 13:55:59: Node name: 'add' --> Attribute name = 'licensekey', Current Value = '', Operation = '1'
InstallShield 13:55:59: Node name: 'add' - Attribute name = 'licensekey', Old Value = '', New value = 'company=;address1=;address2=;address3=;contact=;exp_date=2011-12-24;issue_date=2011-10-25;modules=BaseServer;type=Trial;signature=Gysr+8XJD7D4TYVObfgONYhedTyCZDM9U8vVGc31bguTk2TWF7AI/g==;', Actual New Value = 'company=;address1=;address2=;address3=;contact=;exp_date=2011-12-01;issue_date=2011-10-25;modules=BaseServer;type=Trial;signature=Gysr+8XJD7D4TYVObfgONYhedTyCZDM9U8vVGc31bguTk2TWF7AI/g==;'

The result is like this









What am I doing wrong? or is this a bug in InstallShield?

Best regards,
Jens
Labels (1)
0 Kudos
(7) Replies
skolte
Level 7

Looking at this log statement

Processing XPath '//CompanyLicense/licenses/add[licensekey=[LICENSEKEY]]'

it seems it is searching for 'add[licensekey=[LICENSEKEY]]' rather than just 'licensekey'. That could be the issue.
0 Kudos
Not applicable

Yes, you are right, but my xml file can contain more than one licensekey.

The way you describe, it will not update anything if just one licensekey is present. I only want it, not to update, if exactly the same licensekey is present.
0 Kudos
skolte
Level 7

Is this Basic MSI or pure InstallScript or InstallScript MSI project? I am doing something similar in my project, I have an InstallSCript MSI. The way I do it is I have an InstallScript method that takes two parameters, key and value.
I call it when the web.config is installed (Web_Installed event)..

It searches the XML file (web.config) for the key, if the key is found, it will assign the value. In your case, I would modify this function to check the current value, if it is same as the argument passed, do nothing. On the other hand, if the value is empty or different, or if no key is found, assign the value to the key. If this sounds like what you might need, let me know, I can send you the code I wrote.
0 Kudos
Not applicable

Its a basic MSI, but im already using installscript, so it would be nice to get that code. It would not be nice to have the same xml nodes 10 times after 10 updates

Can it be categorized as a bug in IS 2011?

Will you add the code in here or should I send you a PM with my email address?

Best regards,
Jens
0 Kudos
skolte
Level 7

Jens,

Since putting out just one method may have been confusing, I put together a quick dirty sample to help you out. Please take a look at the attached zip file. It has only one file, a web.config and the config file has just one node 'LicenseKey' with initial value '123456'. The installer installs this file and then updates the LicenseKey to '99999'.

I have built it with InstallShield 2012 Pro version, if you are still on 2011 and for some reason this doesn't open either open the two .Rul files (Setup and FeatureEvents) in notepad to see the code or download the trial version of 2012 Pro just to try it out. I am not using any 2012 specific features so it should technically run in older version.

Let me know if you have any questions.
0 Kudos
Not applicable

Hi. Thanks a lot for your help.

I will look at it later today.

Best regards,
Jens
0 Kudos
mareddy9999
Level 2

skolte wrote:
Is this Basic MSI or pure InstallScript or InstallScript MSI project? I am doing something similar in my project, I have an InstallSCript MSI. The way I do it is I have an InstallScript method that takes two parameters, key and value.
I call it when the web.config is installed (Web_Installed event)..

It searches the XML file (web.config) for the key, if the key is found, it will assign the value. In your case, I would modify this function to check the current value, if it is same as the argument passed, do nothing. On the other hand, if the value is empty or different, or if no key is found, assign the value to the key. If this sounds like what you might need, let me know, I can send you the code I wrote.


Can you send the code? I am having a MSI where i need to add a node when the user changes the input value in maintainance mode. I think your script might help me
0 Kudos