I have a dotnet 6 solution which I deploy with azure-devops in Azure Webapp.
this is part of my yml:
- task: AzureRmWebAppDeployment@4
displayName: 'Deploy WebApp'
inputs:
ConnectionType: 'AzureRM'
azureSubscription: 'xxx'
appType: 'webApp'
WebAppName: 'default-customer'
deployToSlotOrASE: true
ResourceGroupName: 'xxx'
SlotName: 'production'
enableCustomDeployment: true
DeploymentType: 'webDeploy'
packageForLinux: '$(pipeline.workspace)/drop/WebApp.zip'
JSONFiles: '**/appsettings.json'
it worked for a while but now suddenly when I deploy it didn’t work anymore. Actually it should copy the builded solution into the wwwroot folder. but now when I deploy it show me that is was successful, but, in wwwroot is a archive.xml file and a content folder and there in ‘D_C’-> ‘a’ -> ‘1’-> ‘s’ -> ‘myProjectRoot’-> ‘obj’->release -> net6.0 -> … is my project . and in my log in deploy web app I see that instead of extracting the webapp.zip it call the archive button:
Starting: Deploy WebApp
============================================================================== Task : Azure App Service deploy Description : Deploy to Azure
App Service a web, mobile, or API app using Docker, Java, .NET, .NET
Core, Node.js, PHP, Python, or Ruby Version : 4.231.1 Author
: Microsoft Corporation Help :
https://aka.ms/azureappservicetroubleshooting
============================================================================== Got service connection details for Azure App
Service:’default-customer’ /usr/bin/unzip
/home/vsts/work/1/drop/WebApp.zip -d
/home/vsts/work/_temp/temp_web_package_9100078503110456 Archive:
/home/vsts/work/1/drop/WebApp.zip
do you have any suggestion, why it happen?
2
Answers
I found the problem. The problem was that I have a Web app with windows as operating system but the virtual machine that I referenced in my Yml file was Linux.
You can try to check with the following things to fix the issue:
In the build job, reference below steps to configure your build pipeline.
Use the DotNetCoreCLI@2 task instead of the VSBuild@1 task (or MSBuild@1 task) to build. If using the
VSBuild@1
task (orMSBuild@1
task) to build and generate the ZIP file, the ZIP file will contain the unnecessary folder structure "D_C/a/1/s/myProjectRoot/obj/release/net6.0
", just as the issue you are facing.In addition, if some artifact files existed in the old app version but no longer exist in the new version, and you want to remove the legacy additional files when deploying the new version, on the
AzureRmWebAppDeployment@4
task, you can set "RemoveAdditionalFilesFlag: true
".