I've got a .Net Framework 4.6.1 project, which creates a Windows Service. We want to have this built and deployed by an Azure Devops pipeline. We've successfully created pipelines for all of our .Net Core web services (using the ASPNETCORE_ENVIRONMENT variable and a set of appsettings.{ENV}.json files) but the Windows Services don't seem to play as nicely in terms of providing different configuration for different environments.
I've got XDT transformations working for the App.config XML file. I can right click the files in Visual Studio and "Preview Transform" and it works fine.
What's not clear is how I translate this to the pipeline configuration. The Build task seems to be capable of running the transform but then I'm not sure how we have a different transformation for different Deploy stages. What happens instead is that all environments end up with whatever transformation was applied to the Build Configuration selected as part of the Build step.
I've followed numerous blog posts - including this one, which claims you can have multiple build configurations, but for which I don't seem to have the setting.
What am I missing?
Environments can include Kubernetes clusters, Azure web apps, virtual machines, databases. Typical examples of environment names are Dev, Test, QA, Staging, and Production.
The xdt:Transform attribute value "SetAttributes" indicates that the purpose of this transform is to change attribute values of an existing element in the Web.
Web Deploy (msdeploy.exe) can be used to deploy a Web App on Windows or a Function App to the Azure App Service using a Windows agent.
What we do with VSTS which I assume is similar in the newer Azure Devops. We have the transformation add tokens to the config file IE "DefaultConnection": "Server=DBServer;Database=DB;User ID=DBUser;Password=DBPassword;" Then There is a task on the release enviroment called Tokenization which pulls variables set from the release enviorment to replace the underscored tokens.
We use this plugin to do the tokenization step. https://marketplace.visualstudio.com/items?itemName=TotalALM.totalalm-tokenization
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With