7 YEARS AGO

Help: VSTS failed to deploy website (ERROR_FILE_IN_USE)

After several succesful deployments, out of nowhere the release starts to fail with the error: Failed to deploy website and error code: ERROR_FILE_IN_USE.

This error originated by enabling the "Remove additional files at destination" option in the Azure App Service Deploy step:

Additional Deployment Options

In my setup, I deployed Kentico (all-in-one ASP.NET CMS) which generates a 51 degrees file within the App_Data folder. During some deployments, the file was locked and could therefor not be removed.

The way I handled it is too exclude (skip) the folder by passing it as additional argument:

-skip:skipAction='Delete',objectName='dirPath',absolutePath='.*\\App_Data\\51Degrees$'

Exclude folder via skip action

Alternatively you can bypass the 51 degrees detection entirely using the following application setting: <add key="CMSEnable51D" value="false" />

While there might be better alternative solutions, I am pretty happy with the fix :)

Hope this helps!