I have an Azure DevOps pipeline that besides other things installs a Windows service. The service uses a config file that contains a connection string and some license key:
<connectionStrings>
<add name="myConnection" connectionString="Data Source=localhost;Initial Catalog=mydb;UID=username;Password='passwordtobereplaced';Connect Timeout=15;MultipleActiveResultSets=true;"/>
</connectionStrings>
<appSettings>
<add key="SomeApiKey" value="tobereplaced"/>
</appSettings>
The values of the connection string and of the license key need to be replaced in the pipeline. The pipeline has variables myConnection and SomeApiKey with the appropriate values that have to replace placeholders in the config file. I added a File Transform task that should perform the replacement. But to my surprise, only myConnection is replaced, but SomeApiKey is not. What can be the cause?
BTW, the pipeline also deploys a web application that also uses the same settings in Web.config. The IIS web app deploy task has XML Variable Substitution checkbox checked. And in this web.config BOTH variables are replaced correctly.