Divyang Desai
Divyang Desai

Reputation: 7866

FileTransform Task in release pipeline doesn't update the value - AzureDevOps

I'm trying to update the value of appsettings.Development.json file while releasing application using Azure DevOps pipeline.

appSettings.Development.json

{
    "Networks": {
        "EnableNetwork": {
            "SomeNetwork": {
                "SomeValue": "Old Value"
            }
        }
    }
}

I have configured File Transform: task as follows

enter image description here

And set the variable with scope "Release"

enter image description here

File Transfer Task runs successfully

enter image description here

However, it doesn't change the value after deployment. Tried different changes as shown in SO answers like How to change Appsettings and Config info in Release Pipeline. But not sure where is the issue!

Upvotes: 0

Views: 1178

Answers (1)

Kevin Lu-MSFT
Kevin Lu-MSFT

Reputation: 35194

The steps you use File Transform task should be correct. The value of appsettings.Development.json can be updated successfully.

You can check the log of File Transform task to confirm this point.

For example:

enter image description here

it doesn't change the value after deployment.

From your screenshot, the cause of this issue could be that you are using Microsoft-hosted agent to deploy the IIS WebSite. It will deploy the website to hosted agent instead of your local machine.

enter image description here

According to your screenshot of the release pipeline definition, the Stage 3 should be run on Deployment Group. In this case, it will deploy the package to local machine.

You need to check the release pipeline definition to make sure the stage is running on Deployment Group. Then you will see the changes after deployment.

Upvotes: 1

Related Questions