I have the following setup in a Visual Studio 2013 ASP.NET Web API 2 project.
- Web.Develop.config web transform to set an app settings key value
- Web.Release.config web transform to remove an app settings key
- Develop.pubxml to map to the Web.Develop.config transform
- Release.pubxml to map to the Web.Release.config transform
Details for each are found below.
<!-- Web.Develop.config (Web Config Transform) -->
<appSettings>
<add key="ReportInputPath"
value="DevelopPath"
xdt:Transform="SetAttributes"
xdt:Locator="Match(key)" />
</appSettings>
<!-- Web.Release.config (Web Config Transform) -->
<appSettings xdt:Transform="Remove" />
<!-- **Develop.pubxml (Publish Profile) -->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>x64</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>True</ExcludeApp_Data>
<publishUrl>Path</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles
<ExcludeFilesFromDeployment>packages.config</ExcludeFilesFromDeployment>
</PropertyGroup>
</Project>
<!-- Release.pubxml (Publish Profile) -->
<!-- Contents are identical to Develop.pubxml.
This is used to target the Web.Release.Config transform. -->
Whenever I publish the application via the Release publish profile my <appSettings/>
element is successfully removed. However, <appSettings/>
element is removed when the Develop publish profile is run as well.
What I want to understand is:
Why is the <appSettings/>
element being removed when I run the Develop publish profile instead of setting the ReportInputPath value?
And what are the relationships between the between solution/project configurations, publish profiles, and web.config transforms?