1
Vote

web.config settings duplicated when re-activating feature

description

Hey guys,
 
Great utility! I have one problem though: When the feature is set to modify the web.config, the appSetting entries and expressionBuilders entry are duplicated every time the feature is re-activated. This happens because the 'Name' property on the SPWebConfigModification instance isn't set correctly. Two quick changes can address this:
 
Change the Name property in ConfigStoreFeatureReceiver.addAppSetting() from
configMod.Name = string.Format("add[@name='{0}']", sModificationName);
to
configMod.Name = string.Format("add[@key='{0}']", sKey);
 
Change the Name property in ConfigStoreFeatureReceiver.addExpressionBuilder() from
configMod.Name = string.Format("add[@name='{0}']", sModificationName);
to
configMod.Name = string.Format("add[@expressionPrefix='{0}']", sPrefix);
 
Unfortunately web.config entries that were created with the current code will not be removed when deactivating the feature--even with these fixes.

comments