【问题标题】:Build Pipeline keep crashing at Publish level of Azure Functions构建管道在 Azure Functions 的发布级别不断崩溃
【发布时间】:2021-07-09 00:26:20
【问题描述】:

我正在尝试使用 Devops Pipeline (CI) 构建和部署 Azure Function

这是我的步骤

但是直到步骤 Publish 执行之前的一切都没有任何错误。但在发布级别我收到此错误(如上图所示)

Active code page: 65001
Info: .NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents. If you're using these SDK/runtimes on hosted agents, kindly upgrade to newer versions which are not EOL, or else use UseDotNet task to install the required version.
Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
##[error]Project file(s) matching the specified pattern were not found.
Finishing: Publish

我认为这是因为 .Net 版本,所以我在发布之前添加了 Use .NET 5.x 步骤。但它仍然会触发相同的错误。

这是这 3 个步骤的 Yaml

steps:
- task: DotNetCoreCLI@2   displayName: 'dotnet build'   inputs:
    projects: 'Toolset/ScheduledJobs/*.csproj'

steps:
- task: UseDotNet@2   displayName: 'Use .NET Core sdk 5.x'   inputs:
    version: 5.x


steps:
- task: DotNetCoreCLI@2   displayName: Publish   inputs:
    command: publish
    publishWebProjects: false
    projects: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingdirectory)/ScheduledJobs'
    zipAfterPublish: false
    modifyOutputPath: false

请让我知道我在那里做错了什么?

我在 VS 2019 中开发了 Azure Function (3.0)

【问题讨论】:

  • 您没有为发布步骤指定包含项目的路径。查看您的构建步骤与发布步骤。
  • 在 dotnet restore 之前移动也使用 .NET SDK 步骤。

标签: azure-devops azure-functions azure-pipelines .net-5


【解决方案1】:

发布时,您需要提供项目路径,如下所示:

- task: DotNetCoreCLI@2
  inputs:
    command: 'publish'
    publishWebProjects: true
    projects: 'BlazorSample.csproj'
    arguments: '--configuration $(buildConfiguration) --output $(build.artifactstagingdirectory)"'
    zipAfterPublish: false
    workingDirectory: $(Build.SourcesDirectory)/stackoverflow/51-blazor-sample/BlazorSample

请注意最后working directory

同时更改您的订单 bu 放置

- task: UseDotNet@2   displayName: 'Use .NET Core sdk 5.x'   inputs:
    version: 5.x

在此之前:

- task: DotNetCoreCLI@2   displayName: 'dotnet build'   inputs:
    projects: 'Toolset/ScheduledJobs/*.csproj'

【讨论】:

  • 非常感谢......我真的错过了这一点......拯救了我的一天......
  • @SandeepThomas 如果我的回复对您有帮助,您可以考虑点赞吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-03-07
  • 2021-01-17
  • 2021-09-07
  • 2021-03-22
  • 1970-01-01
  • 2020-03-31
  • 1970-01-01
相关资源
最近更新 更多