Config transformations are not limited to web.config files. Thanks to tools like SlowCheetah, you can apply this to any config file.
If you don’t want to introduce an extra dependency, you can still apply these transformations by using the TransformXml task from the Microsoft.Web.Publishing.Tasks.dll inside your msbuild file:
Import the task dll:
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" />
Call the imported task:
<Target Name="AfterBuild">
<MakeDir Directories="$(OutputPath)" Condition="!Exists('$(OutputPath)')" />
<TransformXml Source="App.config" Transform="App.$(Configuration).config" Destination="$(OutputPath)\SampleApp.exe.config" />
<TransformXml Source="App.config" Transform="App.$(Configuration).config" Destination="$(OutputPath)\SampleApp.vshost.exe.config" />
</Target>