Search code examples
iisazure-devopsazure-pipelines-release-pipelinemsdeployazure-pipelines-release-task

Replace parameters.xml or setParams.xml with Azure DevOps Release Pipeline variables


I have a custom config file, which contains parameters to replace at release time with Release Pipeline variables. The replacement of the value in the config file works. If the setParams.xml is bound then the file contains this value, if not then the default value from the parameters definition. My problem now is that I get only the raw value and not the resolved value from configured value in the pipeline.

parameters.xml

<parameters>
    <parameter name="ParameterName" defaultValue="default" description="desc">
        <parameterEntry kind="XmlFile" scope="file.config" match="/xpath/@expression" />
    </parameter>    
</parameters>

setParams.xml (both notations don't work)

<parameters>
    <setParameter name="ParameterName" value="$(Pipeline_Variable)" />
</parameters>

<parameters>
    <setParameter name="ParameterName" value="__Pipeline_Variable__" />
</parameters>

What can I do to replace the parameter of Pipeline_Variable with the configured value using parameters.xml and setParams.xml? I want to avoid to set each parameter in the Azure Tasks as additional console parameters.


Solution

  • If you want to replace Pipeline_Variable in file you should check token replace extension. You just need correctly format tokens in your file based on this what you set in task.

    token replace example