title: Azure DevOps XML Transformation During Release Not Working
body: <p>I want to configure our pipeline to allow one build to be used for multiple environments without having to create separate builds. According to the <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/transforms-variable-substitution?view=vsts" rel="nofollow noreferrer">docs</a>, it seems like it is possible, as it says: </p>
  
  <blockquote>
    <ul>
    <li>You can use this technique to create a default package and deploy it to multiple stages.</li>
    </ul>
  </blockquote>
  
  <p>I named my stage as my environment (preview), and I created a web.config file for that environment (web.preview.config) file. All my environment configuration files in the same path as Web.Config file.</p>
  
  <p>The logs say transformation was complete:</p>
  
  <blockquote>
    <p>2018-11-17T00:26:52.0383966Z [command]D:\a_tasks\AzureRmWebAppDeployment_497d490f-eea7-4f2b-ab94-48d9c1acdcb1\3.4.13\ctt\ctt.exe s:D:\a_temp\temp_web_package_06958915987488234\Content\D_C\a\1\s\Microsoft.Xbox.Mvp\Microsoft.Xbox.Mvp.Api\obj\Preview\Package\PackageTmp\bin\Web.config t:D:\a_temp\temp_web_package_06958915987488234\Content\D_C\a\1\s\Microsoft.Xbox.Mvp\Microsoft.Xbox.Mvp.Api\obj\Preview\Package\PackageTmp\bin\Web.Release.config d:D:\a_temp\temp_web_package_06958915987488234\Content\D_C\a\1\s\Microsoft.Xbox.Mvp\Microsoft.Xbox.Mvp.Api\obj\Preview\Package\PackageTmp\bin\Web.config pw i
    2018-11-17T00:26:52.4335280Z [command]D:\a_tasks\AzureRmWebAppDeployment_497d490f-eea7-4f2b-ab94-48d9c1acdcb1\3.4.13\ctt\ctt.exe s:D:\a_temp\temp_web_package_06958915987488234\Content\D_C\a\1\s\Microsoft.Xbox.Mvp\Microsoft.Xbox.Mvp.Api\obj\Preview\Package\PackageTmp\bin\Web.config t:D:\a_temp\temp_web_package_06958915987488234\Content\D_C\a\1\s\Microsoft.Xbox.Mvp\Microsoft.Xbox.Mvp.Api\obj\Preview\Package\PackageTmp\bin\Web.Preview.config d:D:\a_temp\temp_web_package_06958915987488234\Content\D_C\a\1\s\Microsoft.Xbox.Mvp\Microsoft.Xbox.Mvp.Api\obj\Preview\Package\PackageTmp\bin\Web.config pw i
    2018-11-17T00:26:52.5443873Z XML Transformations applied successfully</p>
  </blockquote>
  
  <p>I can see that it first transformed to release and then it applied preview as the doc says (release then environment). However, although it says XML Transformations applied successfully, when I check the config variables, they are not changed. The only way I could make the transformation work was to define the buildConfiguration variable when I queue a new build, which blocks me from using the same build for different environments.</p>
  
  <p>When I was researching, I found this from this <a href="https://stackoverflow.com/questions/37260243/transform-web-config-for-azure-website-deployment-for-each-release-environment?rq=1">link</a>:</p>
  
  <blockquote>
    <p>Web.config is transformed during the build process, if you generate the deployment package from "Build" and then deploy it in "Release", then you cannot transform it before deployment.</p>
  </blockquote>
  
  <p>But the doc said I can use one default package for multiple stages...Does that still mean I have to create separate build for each environment? Is XML transformation not what I should be looking at for the scenario I wanna solve? </p>
  
  <p>Thank you in advance!</p>
  
  <p>++ Edit:</p>
  
  <p>Release Settings:
  <img src="https://i.stack.imgur.com/qov1m.png" alt="ReleaseSettings"></p>
  
  <p>Release steps (I think? I have a strong feeling that this is what you are looking for...): 
  <img src="https://i.stack.imgur.com/lxnn2.png" alt="ReleaseSteps"></p>