Overview
Web Deployment will let you build a project, and replace sections in the web.config file.
It also has built in tasks for pre/post build, so you can do things like zip up a file, and even install virtual directories for IIS.
It is being used in building the genericODWs, and in addition to a clean "release" build, will be used to have various "test" builds for different databases.
MSDN Documentation
WebConfigReplacementFiles
Include (replace) a section:
Note: for the Release configuration
<ItemGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<WebConfigReplacementFiles Include="Release_appSettings.config">
<Section>appSettings</Section>
</WebConfigReplacementFiles>
<WebConfigReplacementFiles Include="Release_ConnectionStrings.config">
<Section>connectionStrings</Section>
</WebConfigReplacementFiles>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
<OutputPath>.\Release</OutputPath>
<EnableUpdateable>true</EnableUpdateable>
<UseMerge>true</UseMerge>
<SingleAssemblyName>genericODws_deploy</SingleAssemblyName>
<UseWebConfigReplacement>true</UseWebConfigReplacement>
<UseExernalWebConfigReplacementFile>false</UseExernalWebConfigReplacementFile>
<DeleteAppDataFolder>true</DeleteAppDataFolder>
</PropertyGroup>
Point to an external file
Note for a WaterDev configuration
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'WaterDev|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
<OutputPath>.\WaterDev</OutputPath>
<EnableUpdateable>true</EnableUpdateable>
<UseMerge>true</UseMerge>
<SingleAssemblyName>genericODws_deploy</SingleAssemblyName>
<UseWebConfigReplacement>true</UseWebConfigReplacement>
<UseExernalWebConfigReplacementFile>true</UseExernalWebConfigReplacementFile>
<DeleteAppDataFolder>true</DeleteAppDataFolder>
</PropertyGroup>
<ItemGroup Condition="'$(Configuration)|$(Platform)' == 'WaterDev|AnyCPU'">
<WebConfigReplacementFiles Include="WaterDev_appSettings.config">
<Section>appSettings</Section>
</WebConfigReplacementFiles>
<WebConfigReplacementFiles Include="WaterDev__ConnectionStrings.config">
<Section>connectionStrings</Section>
</WebConfigReplacementFiles>
</ItemGroup>