Sadly this is a huge huge hole / disconnect between how MSI works and how 
XML works.   MSI treats a Registry Value and File as atomic but an XML file 
is not atomic.  Elements, Attributes and Values are atomic.


The simplest way, assuming Unity can do this,  is to layer your 
configuration data into 2 files:


1) Stock File that the installer always overwrites and owns

2) Extension / Override file that a user can populate and the installer 
will never overwrite or own.


Then in code layer the data from the two files to drive the program.  If 
Unity can't do this, then yes, you are hosed.  You'll have to write a CA ( 
because WiX has support for XML write but not XML read ) to read the data, 
then overwrite the file and then reapply the data. (  Merge )


There is the "remember property" pattern ( as described for registry here 
http://robmensching.com/blog/posts/2010/5/2/The-WiX-toolsets-Remember-Proper
ty-pattern )  but it really doesn't scale to an application driven but 
boatloads of XML.

----------------------------------------

From: "Richard Martin" <rsmart8...@gmail.com>

Sent: Tuesday, January 24, 2012 4:15 PM

To: wix-users@lists.sourceforge.net

Subject: [WiX-users] .NET config best practices


I'm confused about best practices to use when deploying and maintaining

.NET *.config files via MSI. Our app uses the UnityContainer to manage 
type

injection and type configuration, some of which is environmental, meaning

type config changes at each customer site. This Unity configuration is

stored in a *.config file along with SQL connections, WCF bindings, and

other static environmental information.


We almost always have to update the config with new Unity type mappings

added for each new release as the software grows.


There is a significant amount of configuration required during an install,

so we want to permanently persist the config on the machine even if the

software is uninstalled. Our install techs have had to uninstall the

software before an update to the next version could be applied, so the MSI

package needs to anticipate this scenario.


I'm trying to build a WiX installer that gracefully handles all these

requirements without breaking all the benefits that MSI brings to the

table, like using custom actions to work around challenges I'm having. I

would also like to take advantage of any best practices others have

established as appropriate. At this point, I have a working MSI with the

exception of this one config file.


Here's my idea of the dream config handling:


1) Initial install copies the *.config file


2) Config is updated with appropriate environmental settings


3) Install ensures this file is permanent and will not be removed by

uninstalling.


4) During a software update, settings are harvested from this file


5) The *.config included in the update package is copied over the old

version


6) The new config file is updated with settings harvested from the prior

*.config version.


This file does not make a good candidate for bundling in a component with

another file (KeyPath="no"), since there is no other artifact I want left

behind during uninstall. I'm simply lost trying to get there. I've tried

multiple ideas and all have fallen flat, currently I have Permanent = 
"yes"

on the config's component, which allows the file to be copied and updated

with settings during initial install, but further release updates do not

copy in the new config file included in the package.


How do I get there? Or if these are unreasonable expectations, then what

changes should I make to my installer or our application to accomplish

these goals?


Thanks for any input!


RMartin

----------------------------------------------------------------------------
--

Keep Your Developer Skills Current with LearnDevNow!

The most comprehensive online learning library for Microsoft developers

is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,

Metro Style Apps, more. Free future releases when you subscribe now!

http://p.sf.net/sfu/learndevnow-d2d

_______________________________________________

WiX-users mailing list

WiX-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to