Reputation:
Hello I am having a problem. Suppose I am having a simple web app and pushed it to Azure Repos. Now I set up a build pipeline using yaml and then I set up a release pipeline which will require an artifact from the build pipeline. So I am using PublishPipelineArtifact@1. The build pipeline runs fine but my release pipeline fails with error Deployment of msBuild generated package is not supported. Change package format or use Azure App Service Deploy task. D:\a\r1\a_ReleasePipelines\drop\WebApp.zip. So how to provide artifact required by release pipeline in correct naming sequence?
Below is my yaml for build pipeline
`
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(build.artifactStagingDirectory)'
publishLocation: 'pipeline'
` Next I am setting up a simple release pipeline using empty job and there in Add Artifact I am supplying the project name and source.
Upvotes: 0
Views: 1699
Reputation: 2216
From the MS build arguments in your YAML, it is for Web Deploy method.
If you would like to change the method to Zip deploy, you could follow this official link to change the Arguments: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/azure-rm-web-app-deployment-v4?view=azure-pipelines&viewFallbackFrom=azure-devops#error-publish-using-zip-deploy-option-is-not-supported-for-msbuild-package-type
Publish build artifacts is recommended: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/publish-build-artifacts-v1?view=azure-pipelines&viewFallbackFrom=azure-devops
Here is a sample,
steps:
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
condition: succeededOrFailed()
In your release pipeline, you need to specify the pipeline artifacts from build :
And use Azure App Service Deploy task for the deployment.
Build pipeline sample:
Release pipeline sample:
Upvotes: 0