Create a Azure Pipeline for staging then production environments

I have a question about best practice and Azure Pipeline. I have a web site (ASP.NET API old version) I need to publish on 2 environments

  1. staging
  2. production

I think this schema is classic. At the beginning I decided to create one build in release mode and deploy it on staging first then manually on production after validation. I created this

enter image description here

Then I realized I cannot manage the web.config. This system deploy 2 time the same build with same web.config on my 2 environments. I cannot tell him to use one or another web.config.

So I decided to create 2 builds and manage 2 pipelines separately and trigger the second after validation of the first one. Yes but no. I don’t like the idea to build twice the same code and there is problem. what if my first pipeline is ok and then my second is in error because I always request last change on my branch and I can always have a new change during the deployment process. So no way I must do one build with a 2 phase deployment.

Now, juts tell me. Am I right?

PS: someone that has more rights than me should create the tag azure-pipeline