App/Web Config Files Shared By Linking With Web Config Transformations
<ItemGroup>
<Content Include="..\Shared\App.config">
<Link>App.config</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\Shared\App.Debug.config">
<Link>App.Debug.config</Link>
<DependentUpon>App.config</DependentUpon>
</Content>
<Content Include="..\Shared\App.Local.config">
<Link>App.Local.config</Link>
<DependentUpon>App.config</DependentUpon>
</Content>
<Content Include="..\Shared\App.Test.config">
<Link>App.Test.config</Link>
<DependentUpon>App.config</DependentUpon>
</Content>
<Content Include="..\Shared\App.Staging.config">
<Link>App.Staging.config</Link>
<DependentUpon>App.config</DependentUpon>
</Content>
<Content Include="..\Shared\App.Production.config">
<Link>App.Production.config</Link>
<DependentUpon>App.config</DependentUpon>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets" />
<Target Name="PostTransformAppConfig" AfterTargets="TransformWebConfig">
<Copy Condition="Exists('$(TransformWebConfigIntermediateLocation)\transformed\App.config')" SourceFiles="$(TransformWebConfigIntermediateLocation)\transformed\App.config" DestinationFiles="$(OutputPath)\App.config" />
<Copy Condition="Exists('$(TransformWebConfigIntermediateLocation)\transformed\App.config')" SourceFiles="$(TransformWebConfigIntermediateLocation)\transformed\App.config" DestinationFiles="$(OutputPath)\App.config" />
</Target>