'Azure DevOps Build/Release Pipeline Transform
We're gearing up to use DevOps for our CI/CD process involving ASP.Net web applications, and I'm having trouble getting to "best practice" for the web.config transform step.
The documentation and examples point to putting the transform task in the Release pipeline. In order to do that, though, the Web.Debug/Release/Staging.config (and others) have to be available from the artifacts, which means we have to change the Build Action to Content, which means they wind up as part of the deployed code.
If we do the transform in the Build pipeline, on the other hand, we can keep the transform files out of the deployed code. In this case, though, we have to have discrete builds for each release target, which means our Staging and Production builds will not be bit-identical.
I am certain I'm missing something... but it's been hard to chase down the best practices. I very much appreciate any guidance or thoughts.
Solution 1:[1]
You don't have to include the web.config file(s) in the build artefact; the Release pipeline can read them from source code for itself.
Consider the broad process like this:
- the Build pipeline checks out the code repo; its role is to compile the application code into an executable artefact, without any configuration.
- the Release pipeline also checks out the code repo; it can use configuration files such as web.config or appsettings.json as part of deploying and running the executable in a particular environment.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Vince Bowdren |