We currently publish our web app vis MSDeploy, to create a .ZIP file (file deployment).
I have some .config files that I want to apply transforms to when we publish. So I've created an appSettings.test.config
and an appSettings.live.config
.
To facilitate this, I have added this to the csproj of our web app, which applies the transforms:
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.Tasks.dll" />
<Target Name="ApplyConfigTransforms" BeforeTargets="TransformWebConfigCore">
<TransformXml Source="appSettings.config" Transform="appSettings.$(Configuration).config" Destination="appSettings.config" />
<TransformXml Source="connectionStrings.config" Transform="connectionStrings.$(Configuration).config" Destination="connectionStrings.config" />
</Target>
This hooks in to the TransformWebConfigCore
target and does the work. BUT, it applies the transforms to the appSettings file in my web folder (as expected from the destination). What I want to do is apply the transform to the file in the output pacakge.
How can I do this? I don't know how to get a handle on the temporary folder that is created when you publish..