I have specific config files for specific environments (dev,qa,uat) and another root web.config. The deployed code reads web.config. So I've been trying to either copy the contents or rename the file in Azure Pipelines.
- task: CopyFiles@2
displayName: 'Copy Specific Config'
inputs:
SourceFolder: 'Client.WebApi.Core/Configs/Web.QA.config'
TargetFolder: '$(build.artifactstagingdirectory)\MainWebApi'
- task: CmdLine@2
inputs:
script: rename $(build.artifactstagingdirectory)\MainWebApi\Web.QA.config
$(build.artifactstagingdirectory)\MainWebApi\web.config
Another method:
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
copy-item -path Client.WebApi.Core/Configs/Web.QA.Config -destination Client.WebApi.Core/web.config
TargetFolder: '$(build.artifactstagingdirectory)/MainWebApi'
I have tried various combinations like renaming then copying and copying and then renaming it, copying the contents into new web.config files etc What exactly should be used?
