Recently, while deploying Azure Function from Visual Studio, we got an error “Web Deploy cannot modify the file on the Destination because it is locked by an external process”.
To fix this issue, we created an application setting. There are 2 ways to do this:
- Create an Application Setting in the Function App in Azure portal:
MSDEPLOY_RENAME_LOCKED_FILES = 1
2. Create and Application Setting in the Publish profile for the respective Function App in Visual Studio.
Click on Manage Azure App Service Settings.
Click on Add Setting -> Add setting named “MSDEPLOY_RENAME_LOCKED_FILES” -> Click OK.
Put the value as 1.
After creating the Application Setting when we deployed the Azure Function, it was deployed successfully.
Hope it helps !!