Been stuck on this for days... need help with my YAML file in a Azure Devops Pipeline. I upgraded to .NET 5 and now my Universal Packages are not being properly built.
Background:
I created a new project in Azure Devops and configured a regular Pipeline and a Release Pipeline. The initial (regular) pipeline does not package the proper Universal package. I tested it by downloaded the files using Azure CL and there are no zip files in it.
Following is my YAML file:
# ASP.NET Core (.NET Framework)
# Builds and publishes a new version of each project in the solution as a nuget package in the Artifacts Feed
name : 5.1$(Rev:.r)
# TRIGGER WHEN WE CHECK IN CODE
trigger:
- master
# RUN THIS PIPELINE IN WINDOWS
pool:
vmImage: 'windows-latest'
# USE THESE VARIABLES
variables:
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
universal: 'artifact.web' # the name of the Universal package in the Artifacts feeds
# PERFORM THESE STEPS USING NUGET & MSBUILD:
# 1. RESTORE from nuget
# 2. BUILD solution
# 3. PACK nuget packages
# 4. PUSH packages to Artifacts feed
# 5. Create the Universal Artifacts
steps:
- task: UseDotNet@2
inputs:
version: '5.0.x'
includePreviewVersions: true # Required for preview versions
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 4.4.1'
inputs:
versionSpec: 4.4.1
checkLatest: true
- task: DotNetCoreCLI@2
inputs:
command: 'restore'
feedsToUse: 'select'
vstsFeed: 'ae385ab4-48a5-4c76-b207-dfd1050b8ebf/4b05f135-0b1d-48ad-a8e6-d26bf03c2aae'
- task: DotNetCoreCLI@2
inputs:
command: 'build'
arguments: '--configuration $(buildConfiguration)'
displayName: 'dotnet build $(buildConfiguration)'
- task: DotNetCoreCLI@2
inputs:
command: 'pack'
packagesToPack: '**/*.csproj'
versioningScheme: 'byEnvVar'
versionEnvVar: 'Build.BuildNumber'
includesymbols: true
- task: NuGetCommand@2
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: 'ae385ab4-48a5-4c76-b207-dfd1050b8ebf/4b05f135-0b1d-48ad-a8e6-d26bf03c2aae'
allowPackageConflicts: true
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
publishLocation: 'pipeline'
- task: UniversalPackages@0
displayName: Universal Publish
inputs:
command: publish
publishDirectory: '$(Build.ArtifactStagingDirectory)'
vstsFeedPublish: 'ae385ab4-48a5-4c76-b207-dfd1050b8ebf/4b05f135-0b1d-48ad-a8e6-d26bf03c2aae'
vstsFeedPackagePublish: '$(universal)' # the name of the Universal package in the Artifacts feeds
packagePublishDescription: '$(universal)'
The pipeline completes successfully but the zip files that represent the Universal package are not created.
When I run the Release Pipeline, I get this error:
##[error]Error: No package found with specified pattern.<br/>Check if the package mentioned in the task is published as an artifact in the build or a previous stage and downloaded in the current job.
Any idea how to build a proper Universal file in Azure Devops Pipelines?
PublishPipelineArtifact
– Krzysztof Madej