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'