Created
May 5, 2012 10:39
-
-
Save nul800sebastiaan/2601426 to your computer and use it in GitHub Desktop.
Transform all web.config file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project ToolsVersion="4.0" DefaultTargets="Transform" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<UsingTask TaskName="TransformXml" AssemblyFile="Tools\Microsoft.Web.Publishing.Tasks.dll"/> | |
<PropertyGroup> | |
<SitePath>$(MSBuildProjectDirectory)\..\..\Website</SitePath> | |
<WebConfigTransformFile>Web.Transform.config</WebConfigTransformFile> | |
<OutputFolder>$(MSBuildProjectDirectory)\..\Transformed</OutputFolder> | |
<StackTraceEnabled>False</StackTraceEnabled> | |
</PropertyGroup> | |
<Target Name="Transform"> | |
<!-- discover the files to transform --> | |
<ItemGroup> | |
<FilesToTransform Include="$(SitePath)\**\web.config"/> | |
</ItemGroup> | |
<!-- Ensure all target directories exist --> | |
<MakeDir Directories="$(OutputFolder)"/> | |
<MakeDir Directories="@(FilesToTransform->'$(OutputFolder)\%(RecursiveDir)')"/> | |
<!-- TransformXml only supports single values for source/transform/destination so use %(FilesToTransform.Identity) to send only 1 value to it --> | |
<TransformXml Source="%(FilesToTransform.Identity)" | |
Transform="$(WebConfigTransformFile)" | |
Destination="@(FilesToTransform->'$(OutputFolder)\%(RecursiveDir)\%(Filename)%(Extension)')" /> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment