The answer to the question of why the <appSettings/> element is deleted when the publication publish profile is launched, is that the two conversions are performed in the following order.
- Web.Release.config. This is because the configuration goal in the Develop.pubxml file is to configure the Release assembly.
- Web.Develop.config. This is done because the name of the publication profile (Develop) matches the name of the transformation file.
What happens, the first conversion removes the <appSettings/> element. The second conversion tries to set the key value in this element, but cannot find it, so it silently fails.
I was able to confirm this by doing a search through console output. When the development transformation was completed, there was a warning that the desired item was not found.
Example (shortened for clarity) > TransformXml: Applying Transform File: C:\...\MyProject\Web.Develop.config > C:\...\MyProject\Web.Develop.config(6,4): Warning : No element in the source document matches '/configuration/appSettings' > TransformXml: Not executing SetAttributes (transform line 9, 10)
A profile specific to web.config converts and converts the preview . Sayyid Ibrahim Hashimi's article was very helpful in defining this issue.
As for the relationship between assembly configuration, publishing profiles, and web.config conversion, my current understanding is this.
- Publishing profiles contains (among other things) a configuration goal
- Publishing profiles first starts the conversion, which maps to the specified destination configuration name, if exists
- Publish profiles then start a conversion that displays their publication publish name, if exists
The key here is that two web.config conversions can be performed.
source share