vsb16
Posts: 8
Joined: Mon May 17, 2021 1:37 pm

Don't modify installed files on MSI Repair Option

Tue May 18, 2021 5:30 am

Hello,
We are installing a service through MSI. While installing MSI, data needed for service is saved to xml configuration file. When user selects repair, previously saved data in configuration files gets modified. We don't want modify any configuration file data on repair. Is there any solution for not to modify files on repair ?

Catalin
Posts: 4206
Joined: Wed Jun 13, 2018 7:49 am

Re: Don't modify installed files on MSI Repair Option

Thu May 20, 2021 5:47 pm

Hello and welcome to our forums,

If you do not want to update the XML node during a repair, you can proceed as it follows:

- right click on your .XML file in your project --> "Properties"

- select the node and uncheck the "If the element is found"

This way, the element should not be updated during a repair.

For more information about this, please have a look over the following article:

XML Element Settings Tab

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

vsb16
Posts: 8
Joined: Mon May 17, 2021 1:37 pm

Re: Don't modify installed files on MSI Repair Option

Tue May 25, 2021 6:32 am

Hello Catalin,

Thanks for reply.

As you suggested, I have unchecked "If the element is found" checkbox for required nodes and these nodes did not modify on MSI Repair.

But these nodes are taking default values mentioned in xml configuration file irrespective of values provided at the time of installation.

Earlier when "If the element is found" check box was checked and radio buttons "Update" and "First Matching" are selected, these nodes were taking values provided while installation.

Does this happening because of unchecked "If the element is found" checkbox ?

Thanks and Best Regards,
Vishal

Catalin
Posts: 4206
Joined: Wed Jun 13, 2018 7:49 am

Re: Don't modify installed files on MSI Repair Option

Thu May 27, 2021 5:40 pm

Hello Vishal,

This is quite strange, indeed.

I remember testing the exact scenario you are mentioning right now before giving you the solution and everything worked as expected.

Just to be sure of this, I have run the test again and it indeed worked - the XML file contained the value I offered at install time.

Here is the project I have used:
Vishal Sample - XML Update.zip
(3.47 KiB) Downloaded 123 times

Could you please have a look over it and let me know if everything worked as expected?

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

vsb16
Posts: 8
Joined: Mon May 17, 2021 1:37 pm

Re: Don't modify installed files on MSI Repair Option

Mon May 31, 2021 6:06 am

Hello Catalin,

Thanks for the reply.

I have tested the sample project you provided. It is working as expected.

But we are using configuration file having nodes like

<appSettings>
<add key="Name" value="Vishal" />
</appSettings>


And we are setting node properties in Attributes Tab

I have tested same scenario for these nodes. But it is not working as I told earlier.

Can you please check for similar configuration files.

Thanks and Best Regards,
Vishal

Catalin
Posts: 4206
Joined: Wed Jun 13, 2018 7:49 am

Re: Don't modify installed files on MSI Repair Option

Thu Jun 03, 2021 2:41 pm

Hello Vishal,

I have run a test with a similar XML file to the one you have described (if I understood correctly your scenario) and it worked as expected.

Here is how the XML file is looking for me:

Code: Select all

<appSettings>
<add key="Name" value="Catalin" />
<add key="Age" value="24" />
</appSettings>
If, for the first "add" node I uncheck the "If the element is found" option:
IfElementIsFound.png
IfElementIsFound.png (35.99 KiB) Viewed 4487 times

and then use the "Attributes" tab to pass the value for the "Name" key:
Attributes.png
Attributes.png (28.41 KiB) Viewed 4487 times

everything works as expected.

With that being said, could you please forward me a sample XML file that can help me reproduce this on my end so I can further investigate this?

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

vsb16
Posts: 8
Joined: Mon May 17, 2021 1:37 pm

Re: Don't modify installed files on MSI Repair Option

Mon Jun 07, 2021 11:02 am

Hello Catalin,

Thanks for your reply.

I have investigated on our AI project, I found that we were having two xml file in Files and Folders -> Application Folder with same name.

1.XML File (Windows Installer) and

2.XML File ( XML Configuration File ) (We have added this xml and kept default data similar to xml file generated on installation)

So, I removed 2nd configuration file, unchecked the If element is found checkbox and added default values to corresponding AI Properties(variables).

As you confirmed, It was taking the data provided at installation time and all other variables were taking default property values.

So this works fine for me now.

I think the issue was with 2 XML files. Because of which it was not taking data provided while installation.

Do you think above issue was because of 2 XML files ?

Now, I performed repair on MSI. I found repair behavior is not same through maintenance dlg and Right Click -> Repair on installed MSI

1.For repair through Maintenance dlg, xml configuration file was not changing and hence repair was working fine.

2.But for Right Click->Repair, AI variables nodes (the nodes corresponding to AI variables to which values are set through UI) were modifying and taking empty values.

For these changing properties, I have checked Set Persistent Property checkbox and performed repair through both cases. Now It's working fine and configuration file is not modifying.

Above properties are getting saved in registry, actually we don't want these to be saved in registry.

Do you recommend above steps or any other possible way for not modifying configuration file on MSI Repair ?

Thanks and Best Regards,
Vishal

Catalin
Posts: 4206
Joined: Wed Jun 13, 2018 7:49 am

Re: Don't modify installed files on MSI Repair Option

Tue Jun 08, 2021 4:30 pm

Hello Vishal,

Thank you for your followup on this!

I am glad you were able to find the culprit. And indeed, most likely, that happened due to the two XML files.
2.But for Right Click->Repair, AI variables nodes (the nodes corresponding to AI variables to which values are set through UI) were modifying and taking empty values.

For these changing properties, I have checked Set Persistent Property checkbox and performed repair through both cases. Now It's working fine and configuration file is not modifying.

Above properties are getting saved in registry, actually we don't want these to be saved in registry.

Do you recommend above steps or any other possible way for not modifying configuration file on MSI Repair ?
The approach you have used here is indeed the correct one, as it is also explained in our "How do I make the properties in the package keep their values during Maintenance or Upgrade?" article.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

vsb16
Posts: 8
Joined: Mon May 17, 2021 1:37 pm

Re: Don't modify installed files on MSI Repair Option

Wed Jun 09, 2021 1:20 pm

Hello Catalin,

Thanks for your help.

I have marked required AI properties as persistent.

1.During the first time install properties are saved to xml and registry.
Repair will work fine and configuration would be same as before.

2.But what if user has modified the xml nodes manually. Now AI variable values in xml file & registry are different.
Repair will not work as expected as variables will take earlier values and ultimately configuration file will change.

Can we update registry values when user had modified configuration manually?
What can be the solution for 2nd case ?

We have used Search Custom Behavior which reads data from configuration file and sets to AI properties. This search only works for Modify and Upgrade.

Can we execute Search before executing Repair through maintenance dialog or Right Click which will read data from current configuration file and set to corresponding variables?

Thanks & Best Regards,
Vishal

Catalin
Posts: 4206
Joined: Wed Jun 13, 2018 7:49 am

Re: Don't modify installed files on MSI Repair Option

Tue Jun 15, 2021 5:32 pm

Hello Vishal,
Can we execute Search before executing Repair through maintenance dialog or Right Click which will read data from current configuration file and set to corresponding variables?
I have tested this just now with a registry search and a messagebox custom action (that executes only on Maintenance) that outputs the result of the search and it worked as expected during a Repair operation.

So the answer is yes, this should be possible.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

vsb16
Posts: 8
Joined: Mon May 17, 2021 1:37 pm

Re: Don't modify installed files on MSI Repair Option

Wed Jun 16, 2021 9:59 am

Hello Catalin,

Thanks for your help.
I have tested this just now with a registry search and a messagebox custom action (that executes only on Maintenance) that outputs the result of the search and it worked as expected during a Repair operation.
Have you tried both cases of repair(i.e Maintenance dlg and Right Click ) ?
1.During the first time install properties are saved to xml and registry.
Repair will work fine and configuration would be same as before.

2.But what if user has modified the xml nodes manually. Now AI variable values in xml file & registry are different.
Repair will not work as expected as variables will take earlier values and ultimately configuration file will change.
Repair with registry search will not work for above 2nd case as registry values and current configuration file values are different.

What can be the possible solution for above 2nd case ?

Thanks and Best Regards,
Vishal

Catalin
Posts: 4206
Joined: Wed Jun 13, 2018 7:49 am

Re: Don't modify installed files on MSI Repair Option

Mon Jun 28, 2021 4:26 pm

Hello Vishal,
Have you tried both cases of repair(i.e Maintenance dlg and Right Click ) ?
Please note that here only the execution method is different, but the result is the same. What I mean by this is that right clicking on the MSI --> "Repair" has the same effect as doing the "Repair" from Control Panel.
Repair with registry search will not work for above 2nd case as registry values and current configuration file values are different.

What can be the possible solution for above 2nd case ?
Perhaps an XML search would do the trick here, if the XML is where the correct values are at.

For more information about an XML search, please have a look over the following article:

Creating an XML search

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

vsb16
Posts: 8
Joined: Mon May 17, 2021 1:37 pm

Re: Don't modify installed files on MSI Repair Option

Mon Jul 12, 2021 8:14 am

Hello Catalin,

Thanks for your help.
Perhaps an XML search would do the trick here, if the XML is where the correct values are at.
We have implemented the XML search & it works fine for Modify & Upgrade..
But after Repair configuration file changes as mentioned in previous posts.

AI properties which are initially empty (these AI property values are set through installation UI) take empty values after Repair, though previous XML has correct values.

Thanks & Best Regards,
Vishal

Catalin
Posts: 4206
Joined: Wed Jun 13, 2018 7:49 am

Re: Don't modify installed files on MSI Repair Option

Tue Jul 20, 2021 6:04 pm

Hello Vishal,

I am not quite able to replicate the behavior you described.

In order for me to further investigate this, could you please create a sample project (together with a sample XML file) that reproduces this and forward it to me together with a test case which I can follow in order to reproduce the problem?

You can attach the sample either here or you can send it by e-mail at support at advancedinstaller dot com.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”