Azure App Service Deploy, Azure Web App Deploy and Azure Functions Deploy task supports Run From Package as default deployment mechanism, as it has many benefits compared to MSDeploy (Web Deploy).
But, Web packages created using MSBuild task (with default arguments) has a nested folder structure that can only be deployed correctly by Web Deploy. If Run From Package is used for the above packages, the web package would be copied without honoring the nested folder structure and can cause runtime issues.
To convert the packaging structure, follow the below steps:
-
In Build Solution task, change the MSBuild Arguments to
/p:DeployOnBuild=true /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:DeleteExistingFiles=True /p:publishUrl="$(System.DefaultWorkingDirectory)\\WebAppContent"
-
Add Archive Task and change the inputs as follows:
- Change
Root folder or file to archive
to$(System.DefaultWorkingDirectory)\\WebAppContent
- Disable
Prepend root folder name to archive paths
option
- Change