Created
September 11, 2015 03:05
-
-
Save guitarrapc/38de1ad255cfce02a3d0 to your computer and use it in GitHub Desktop.
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
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" /> | |
<Target Name="AfterCompile" Condition="Exists('App.$(Configuration).config')"> | |
<!--Generate transformed app config in the intermediate directory--> | |
<TransformXml Source="App.config" Destination="$(IntermediateOutputPath)$(TargetFileName).config" Transform="App.$(Configuration).config" /> | |
<!--Force build process to use the transformed configuration file from now on.--> | |
<ItemGroup> | |
<AppConfigWithTargetPath Remove="App.config" /> | |
<AppConfigWithTargetPath Include="$(IntermediateOutputPath)$(TargetFileName).config"> | |
<TargetPath>$(TargetFileName).config</TargetPath> | |
</AppConfigWithTargetPath> | |
</ItemGroup> | |
</Target> | |
<!--Override After Publish to support ClickOnce AfterPublish. Target replaces the untransformed config file copied to the deployment directory with the transformed one.--> | |
<Target Name="AfterPublish"> | |
<PropertyGroup> | |
<DeployedConfig>$(_DeploymentApplicationDir)$(TargetName)$(TargetExt).config$(_DeploymentFileMappingExtension)</DeployedConfig> | |
</PropertyGroup> | |
<!--Publish copies the untransformed App.config to deployment directory so overwrite it--> | |
<Copy Condition="Exists('$(DeployedConfig)')" SourceFiles="$(IntermediateOutputPath)$(TargetFileName).config" DestinationFiles="$(DeployedConfig)" /> | |
</Target> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment