Publishing Azure Function with Web Deploy: Web deployment task failed

Problem Statement

I’ve created an Azure Function and I’m using Web Deploy and a VS publish profile for quick test deployments before I build out my full release pipelines. When I publish the function more than once, I get this error:

Microsoft.NET.Sdk.Publish.MSDeploy.targets(139,5): error : Web deployment task failed. (Web Deploy cannot modify the file on the destination because it is locked by an external process. In order to allow the publish operation to succeed, you may need to either restart your application to release the lock, or use the AppOffline rule handler for .Net applications on your next publish attempt. Publish failed to deploy.


Open the Azure Portal and navigate to your Azure Function. Go to Application Settings and add this setting


This will allow you to overwrite files in your directory.

I hope this helps someone,

Happy coding,

Tom Hundley
Elegant Software Solutions

What are your thoughts?

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.