Setting takeAppOfflineFlag to true adds -enableRule:AppOffline to the msdeploy arguments which resolves the following error:
Warning: An error was encountered when processing operation 'Create File' on '...'.
Retrying operation 'Update' on object filePath (...). Attempt 1 of 5.
Warning: An error was encountered when processing operation 'Create File' on '...'.
Retrying operation 'Update' on object filePath (...). Attempt 2 of 5.
Warning: An error was encountered when processing operation 'Create File' on '...'.
Retrying operation 'Update' on object filePath (...). Attempt 3 of 5.
Warning: An error was encountered when processing operation 'Create File' on '...'.
Retrying operation 'Update' on object filePath (...). Attempt 4 of 5.
Warning: An error was encountered when processing operation 'Create File' on '...'.
Retrying operation 'Update' on object filePath (...). Attempt 5 of 5.
##[error]Package deployment failed
##[warning]Try to deploy web app with rename option set
##[error]Error Code: ERROR_FILE_IN_USE
More Information: 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. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE.
Error: The process cannot access the file because it is being used by another process.
Error count: 1.
##[error]The process 'msdeploy' failed with exit code 4294967295
Port
takeAppOfflineFlag
from Azure Pipelines taskSetting
takeAppOfflineFlag
totrue
adds-enableRule:AppOffline
to themsdeploy
arguments which resolves the following error: