Reputation: 709
I am trying to deploy a .Net WebApp on Azure App Service using Azure DevOps. Everything works fine when I build and deploy the generated .zip file using build and release pipelines.
But when I try to store the built artifact as a Package in Azure Artifacts and then try to deploy that package using Release, it is not working.
My Build pipeline
trigger:
- ubuntu-build
pool:
vmImage: 'ubuntu-latest'
stages:
- stage: Build_Stage
displayName: Build .NetCore App
jobs:
- job: webapp
displayName: Build App
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: DotNetCoreCLI@2
inputs:
command: 'build'
projects: '**/*.csproj'
arguments: '--configuration $(buildConfiguration)'
- task: DotNetCoreCLI@2
inputs:
command: 'publish'
publishWebProjects: true
arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
- script: ls $(Build.ArtifactStagingDirectory)
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifact: 'WebApp'
publishLocation: 'pipeline'
- job: publish
displayName: Publish artifact to Azure Artifacts
dependsOn: webapp
steps:
- task: DownloadBuildArtifacts@1
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'WebApp'
downloadPath: '$(Build.ArtifactStagingDirectory)'
cleanDestinationFolder: true
- script: ls $(Build.ArtifactStagingDirectory)
- task: UniversalPackages@0
inputs:
command: 'publish'
publishDirectory: '$(Build.ArtifactStagingDirectory)/webapp.zip'
feedsToUsePublish: 'internal'
vstsFeedPublish: 'id'
vstsFeedPackagePublish: 'webapp'
versionOption: 'minor'
I can see the generated artifact in Azure Artifacts
I have added it as an Azure Artifact in the Release Pipeline
However, when I try to add it in the App Service Deploy task, I get this 'This artifact cannot be browsed.' at the top. This is unlike when I use a Build artifact where I can select the actual generated .zip file.
Is there something I am doing wrong in build or in storing the generated .zip file in Azure Artifacts?
Upvotes: 0
Views: 601
Reputation: 5642
'This artifact cannot be browsed.'
This message means that when you are configuring the pipeline, the pipeline doesn't know what files are in the artifact package.
As you mentioned in the comment, you can add the /webapp.zip
and use $(System.DefaultWorkingDirectory)/_webapp/webapp.zip
as input since you know this zip file is in the package. But when we configure the pipeline, the pipeline does not try to get the files in the package.
You can also view the Azure Artifact page. It also doesn't show on the page which files are included in the package. If you're using a package uploaded by another user, you won't know what's in it until you download it using the universal download command.
Upvotes: 1