vsb16
Posts: 14
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: 6542
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: 14
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: 6542
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.47KiB)Downloaded 524 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: 14
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: 6542
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.99KiB)Viewed 16715 times

and then use the "Attributes" tab to pass the value for the "Name" key:
Attributes.png
Attributes.png (28.41KiB)Viewed 16715 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: 14
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: 6542
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: 14
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: 6542
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: 14
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: 6542
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: 14
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: 6542
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

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

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

Wed Aug 04, 2021 7:30 am

Hello Catalin,

Firstly please accept my apologies for delay in reply.

As you suggested, I have created sample AIP project similar to our existing project. You can go through AIP project which generates xml file to save needed data, dumps some dll in installation directory & has XML search which we require for MSI Modify & Upgrade

XML search works fine for MSI Modify for both cases mentioned below.

But when we perform Repair(through Right Click on MSI) for Case 1, configuration file changes. As AI properties which are set empty in .aip project takes empty node values causing change in previously saved data.

We don't want our xml data to be changed on Repair which we are storing while First Time Install

You can follow below test cases for MSI Repair issue.

Case 1 - XML Search Path is [ApplicationFiles_Dir]TestApplicationService.exe.config
Steps:
1)Set File Path as [ApplicationFiles_Dir]TestApplicationService.exe.config in XML Search Tab
2)Build the MSI
3)Install MSI by providing information on New Dialog(Dlg containing server related info)
4)Perform MSI Modify for which XML search works fine.
5)Go to installation folder copy generated TestApplicationService.exe.config
6)Right Click MSI. Select Repair option.
7)Go to installation directory copy TestApplicationService.exe.config.
8)Compare two files you will find change in xml nodes. (*We don't to want change data saved on installation*)
9)Please refer ApplicationFilesPath.PNG & APPDIR_XMLFile.PNG
ApplicationFilesPath.PNG
ApplicationFilesPath.PNG (55.92KiB)Viewed 10389 times
APPDIR_XMLFile.PNG
APPDIR_XMLFile.PNG (46.21KiB)Viewed 10389 times

Case 2 - XML Search Path is C:\Program Files\TestCompony\TestApplicationService\ApplicationFiles\TestApplicationService.exe.config
Steps:
1)Set File Path as C:\Program Files\TestCompony\TestApplicationService\ApplicationFiles\TestApplicationService.exe.config in XML Search Tab
2) Steps 2-7 are same as Case1
7)Compare two files you will find both XMLS are same.
8)Please refer CDrive_XMLFile.PNG & CDrivePath.PNG/b] from attached zip.
TestApplication.rar
(95.4KiB)Downloaded 318 times
Why xml data changes for Case 1 & not for Case 2 ?

We want to implement the Case -1 for which xml should not be changed after Repair as user may select any installation directory but,

How can we restrict xml change on MSI repair through Right Click as well as Repair through Maintenance Dlg ?


Please find attached project files for reference. (There was one dll in ApllicationsFiles folder that I had removed due file size issue)

Please go through attached file and suggest a solution so that first time install xml data remains same on both Repair cases(R Click Repair & Maintenance Repair)

Thanks & Best Regards,
Vishal

Return to “Common Problems”