Azure pipeline cannot find published artifact

Sam Wheat 501 Reputation points
2021-12-19T19:35:42.55+00:00

I am trying to deploy my dotnet app following these instructions.

Depending on how I specifiy the output folder of the build (or don't specifiy it at all) I get different error messages. My yaml as shown below generates this error:

[error]Archive read error

If I don't specifiy the output or don't specify a project name I get:

[error]A publish folder could not be found to zip for project file: .

I slso get:

[error]Error: More than one package matched with specified pattern: D:\a\1\s***.zip. Please restrain the search pattern.

[error]Error: No package found with specified pattern: D:\a\1\a\API***.zip<br/>Check if the package mentioned in the task is published as an artifact in the build

My app is very simple:

Blog // Angular, no .csproj

Blog.API // .net6 web app

Blog.xx // supporting .dll libraries. Note I also rely on a nuget in my personal Azure nuget feed.

I am deploying to a single Azure WebApp with two virtual apps: / runs the Angular website, /API runs the .net web API.

Entire yaml script is included below for completeness however the part I am having a problem with is after the comment "# Build and deploy API"

trigger:  
- master  

pool:  
  vmImage: 'windows-latest'  

variables:  
  solution: '**/*.sln'  
  project: '**/Blog.API/Blog.API.csproj'  
  buildPlatform: 'Any CPU'  
  buildConfiguration: 'Release'  
  azureSubscription: 'x'  
  appName: 'MyApp'  
  system.debug: false  

steps:  

Install dependencies

- task: NodeTool@0  
  displayName: Install Node  
  inputs:  
    versionSpec: '16.13.1'  

- script: |  
    npm install -g npm@8.3.0  
  displayName: Update NPM  

- script: |  
    npm install -g @angular/cli  
  displayName: Install Angular CLI  

- task: NuGetToolInstaller@1  
  displayName: 'Install NuGet'  

Build and deploy WebApp

- script: |  
    cd Blog/ClientApp  
    npm install  
  displayName: 'npm install'  

- script: |  
    cd Blog/ClientApp  
    npm run build:prod  
  displayName: 'npm build'  

- publish: '$(System.DefaultWorkingDirectory)/Blog/ClientApp/dist/'  
  artifact: WebApp  

- task: AzureWebApp@1  
  displayName: 'Deploy Azure Web App'  
  inputs:  
    azureSubscription: $(azureSubscription)  
    appType: webApp  
    appName: $(appName)  
    artifactName: WebApp  

Build and deploy API

- task: UseDotNet@2  
  displayName: 'Use dotnet 6'  
  inputs:  
    packageType: 'sdk'  
    version: '6.x'  

- task: DotNetCoreCLI@2  
  displayName: 'DotNet Restore NuGet packages'  
  inputs:  
    command: 'restore'  
    feedsToUse: 'select'  
    vstsFeed: 'myFeed'  
    includeNuGetOrg: true  

- script: dotnet build --configuration $(buildConfiguration)  
  displayName: 'dotnet build $(buildConfiguration)'  

- task: DotNetCoreCLI@2  
  displayName: 'Publish API'  
  inputs:  
    command: 'publish'  
    configuration: $(buildConfiguration)  
    projects: $(project)  
    arguments: '-o $(System.DefaultWorkingDirectory)/webapi.zip'  


- task: AzureWebApp@1  
  displayName: 'Deploy API'  
  inputs:  
    azureSubscription: $(azureSubscription)  
    appType: webApp  
    appName: $(appName)  
    virtualApplication: '/api'  
    package: '$(System.DefaultWorkingDirectory)/**/webapi.zip'  
Community Center | Not monitored
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2021-12-19T20:28:33.963+00:00

    The product group for Azure DevOps / TFS actively monitors questions over at
    https://developercommunity.visualstudio.com/report?space=21&entry=problem
    https://developercommunity.visualstudio.com/report?space=22&entry=problem

    --please don't forget to upvote and Accept as answer if the reply is helpful--

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.