我需要帮助来设置我的 azure-pipelines.yml 构建文件,因为我在任何地方都找不到任何好的教程、示例或其他类型的帮助。
我遵循微软的这个教程https://learn.microsoft.com/en-us/azure/devops/pipelines/languages/dotnet-core?view=azure-devops https://learn.microsoft.com/en-us/azure/devops/pipelines/languages/dotnet-core?view=azure-devops但尽管他们提供了所有信息,我仍然遇到错误。
azure-pipelines.yml
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
pool:
vmImage: 'Ubuntu-16.04'
variables:
buildConfiguration: 'Release'
steps:
# - script: dotnet build --configuration $(buildConfiguration)
# displayName: 'dotnet build $(buildConfiguration)'
- task: DotNetCoreInstaller@0
inputs:
version: '2.2.202' # replace this value with the version that you need for your project
- script: dotnet restore
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: build
projects: '**/*.csproj'
arguments: '--configuration Release' # Update this to match your need
# do this after you've built your app, near the end of your pipeline in most cases
# for example, you do this before you deploy to an Azure web app on Windows
- task: DotNetCoreCLI@2
inputs:
command: publish
publishWebProjects: True
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: True
- task: PublishBuildArtifacts@1
inputs:
ArtifactName: 'drop'
Log
##[section]Starting: DotNetCoreCLI
==============================================================================
Task : .NET Core
Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command. For package commands, supports NuGet.org and authenticated feeds like Package Management and MyGet.
Version : 2.150.1
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?linkid=832194)
==============================================================================
##[error]No web project was found in the repository. Web projects are identified by presence of either a web.config file or wwwroot folder in the directory.
##[error]Project file(s) matching the specified pattern were not found.
##[section]Finishing: DotNetCoreCLI
为什么会出现这些错误以及我做错了什么?
附加信息- 我可以从 Visual Studio 构建并发布到我的 Azure Web 应用程序。我的 API 正在运行。我只是无法将其作为 CI/CD 的一部分来完成。
- 我不明白这个错误,因为我不明白为什么 DotNetCore 请求 web.config。