I am currently deploying an web application on which I have an appsetting for production purposes and one for test purposes. how do i during deploy replace the appsetting.json with the content of the production or test?
to deploy i use IIS web app manage and IIS web app deploy.
What I currently do is everytime something is pushed to main, I have setup Azure to trigger an
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
testConfiguration: 'Test'
prodConfiguration: 'Production'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)"'
platform: '$(buildPlatform)'
configuration: '$(testConfiguration)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)"'
platform: '$(buildPlatform)'
configuration: '$(prodConfiguration)'
- task: DotNetCoreCLI@2
inputs:
command: 'publish'
publishWebProjects: true
zipAfterPublish: true
arguments: '--output $(build.artifactstagingdirectory)'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
I then use the artifact created in drop to for deploy purposes. The problem occur when I want to deploy to either my test or production environment.
The solution itself has an a transform on the appsetting.json, namely the appsetting.Test.json and appsetting.Production.json but what is located in the drop folder is only the prod build published, and not both test and prod.
How do i include both under the drop folder?
So when I release it via the deploy pipeline can specify that I want to deploy the test build or prod build?