December 2020 - Digital Tool Factory blog December 2020 - Digital Tool Factory blog

The Digital Tool Factory Blog

How to change out appsettings.json files upon in an Azure DevOps Release

As I continue to explore Blazor I came across an interesting problem – to wit – how does one change the appsettings.json in an Azure Release? Ideally you would want to use the appsettings.QA.json in your QA environment, your appsettings.Dev.json in your dev environment, etc. I could not find any obvious way of doing this.

Were is regular mvc 5 I could just name the release stage “QA” and the magic of Azure would do the necessary web.config changes (i.e. change to web.config upon release/publish.)

After writing out an email to a friend to ask him how he would do it I came across the answer – on this blog post actually. The key is to add an ASPNETCORE_Environment variable to whatever it is you want your environment to be, i.e. if you have appsettings.PublicDev.json you would just need to add an ASPNETCORE_ENVIRONMENT value of “PublicDev” – then release!

Dec 20

Written By Steve French


Copyright 2011 Digital Tool Factory. All Rights Reserved. Powered by raw technical talent. And in this case, WordPress.