Skip to content

Instantly share code, notes, and snippets.

@hagbarddenstore
Last active August 29, 2015 14:01
Show Gist options
  • Save hagbarddenstore/e184cae556db0e4171b8 to your computer and use it in GitHub Desktop.
Save hagbarddenstore/e184cae556db0e4171b8 to your computer and use it in GitHub Desktop.
Performs config transformations on build in Visual Studio while keeping compatibility with OctoDeploy which performs config transformations on release.
<?xml version="1.0" encoding="utf-8"?>
<!-- -->
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<Target Name="BeforeBuild" Condition="$(BuildingInsideVisualStudio)">
<Move SourceFiles="App.config" DestinationFiles="App.Base.config" />
<TransformXml Source="App.Base.config" Transform="App.$(Configuration).config" Destination="App.config" />
</Target>
<Target Name="AfterBuild" Condition="$(BuildingInsideVisualStudio)">
<Move SourceFiles="App.Base.config" DestinationFiles="App.config" />
</Target>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment