[wix-users] Can we reset NeverOverwrite setting in a Patch.msp

Christopher Painter chrpai at iswix.com
Fri Jan 10 08:20:02 PST 2020


Might a make a suggestion for future projects if it's too late for this project.

It's been my experience that trying to decide when to overwrite and when not to overwrite is a losing game.    XML files such as app.config/web.config files are a no-win battle that is best to avoid.  Imagine:

Version 1  app.config  has some schema
Customer/Installer modifies app.config to contain some user data

Version 2 app.config has a baseline schema change.

If the installer overwrites the file the user data is lost.  If the installer doesn't overwrite the file the baseline schema change in version  2 is lost.

Sure, you could write some custom actions that persists the user data but it all gets complicated and fragile quickly.

So what is my suggestion?   Keep user data in it's own file the installer doesn't know about.   The installer doesn't overwrite what it doesn't know and the main app.config file can always be safely overwritten.

.NET even has built in support for this.

https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/appsettings/appsettings-element-for-configuration

https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/connection-strings-and-configuration-files


By designing the application to keep the installer owned data and customer owned data separate you greatly simplify the problem and everything just works.


One of these days I'm going to make this a blog article.....



________________________________
From: wix-users <wix-users-bounces at lists.wixtoolset.org> on behalf of Mouni K via wix-users <wix-users at lists.wixtoolset.org>
Sent: Friday, January 10, 2020 8:12 AM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Cc: Mouni K <mouni.c2cbit at gmail.com>
Subject: [wix-users] Can we reset NeverOverwrite setting in a Patch.msp

Hi WiX Users,

Below is my question-

We have certain web and app.config files which are set as
NeverOverwrite='yes' in the Major Release say 17.0 MSI1 (Setup.msi), so
that they wont be overwritten during subsequent maintenance patches.


*<Component Id="ServiceConfig" Guid="xxxx-xxxx-xxxxxx-xxxxxx-xxxxxxx"
NeverOverwrite="yes">            <File
Name="Dom.Common.Attributes.dll.config" Id="fileB12346799C67BADJB3456VT688"
KeyPath="yes" />*

Now we have a change in those config files which need to be delivered in a
Patch.msp.
If we build a maintenance MSI2 (which has our latest changes to the config
files) by setting the above component NeverOverwrite='no',will the diff
Patch.msp generated out of MSI1 and MSI2 install/overwrite the older config
files with the latest ones?

Or should this only be done by a Major Upgrade MSI?

Thanks,
Mounika.

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/



More information about the wix-users mailing list