cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
blitz89
Level 3

Complex Xml File - Feature Based

Hello. We have a database driven application, in which we are deploying multiple possible data sets in our application. I organize the data sets we realize as features, and that works out very nice in IS 2008.

However, each feature has a few attributes associated in our xml config file, which must be updated for the product to run. I cannot find a good way to update the file through Xml File Changes so that one file gets updates from each feature.

Here is my work-around. For each feature, I create a same named xml file. Then, at installation, each selected feature then gets its updated keys into the file. Since its the same named file, it writes fine.

Is there a better way to work with the config file based on features? The issue is, it gets very messy, having so many same named xml files, but in the Xml File Changes View, I atleast get to view the feature tree to identify them, but nowhere else is it that easy. When assigning to features, they come across as ***.config, ***.config1,2,3 etc.... and its very difficult to determine which is which, and I cant have unique names.

I use MsiSetProperty in InstallScript to set the values to them based on selections. Is that the best way to handle the attributes?

Thanks in advance. I am just trying to make the best use of the Xml File Changes to setup the config file.
Labels (1)
0 Kudos
(3) Replies
MichaelU
Level 12 Flexeran
Level 12 Flexeran

If for any given installation choice there is only the one file, you should probably set this up as a single XML File Changes component. Then by attaching that same component to all the features in question (right click the features > Associate Components... in the Setup Design view), no matter which of the features are installed, the component with the XML File Changes will be installed.
0 Kudos
blitz89
Level 3

Ok, I see your point. But I believe my situation is still a little more complicated than that. As you said, for any installation, there is only one file, but each feature has its own unique entry into the same file. So, for each selected feature, I want to add a feature specific entry.
I cannot have entries in the file for features not selected, which is why I am trying to associate elements with their features.
Is there a way to associate just certain elements with features then?

So, I have multiple copies of the same name xml now with each possible feature, and associate each to its own feature (as you described). That way only certain elements are added. Also, the core application must be selected so that an initial structure of the file is always created.

MyXml (elements for core app)
MyXml(1) -> Feature 1
MyXml(2) -> Feature 2
etc....

I find this works but am not sure if its the best way to set up the xml config file.
0 Kudos
MichaelU
Level 12 Flexeran
Level 12 Flexeran

If this were a custom attribute value, it would be fairly easy to reference a property and change the property's value based on which feature was being installed. As is, I think you're right; the XML file changes isn't the best fit, as it expects too much all or nothing. If your way of splitting it up is working, it's probably the best you can do with the built-in functionality. If your changes get too complicated to maintain, though, you may find it easier to go to custom actions instead of (or perhaps in addition to) InstallShield functionality.
0 Kudos