【问题标题】:Error deploying a folder artifact to Azure app service将文件夹项目部署到 Azure 应用服务时出错
【发布时间】:2020-10-19 10:33:37
【问题描述】:

我正在使用 Azure Dev Ops 来运行我的构建和发布管道。我有一个构建脚本,可以将我的 Web 代码发布到一个工件文件夹(使用 .NET SDK 项目),我只需要将这个代码推送到我的 Azure 应用服务中。我已经在发布管道中尝试了“Azure 应用服务部署”和“将代码部署到应用服务”任务,将我的 Azure 实例中的发布设置文件提供给它,并用我的代码指向文件夹(因为它说它需要 zip或文件夹)。然而,在这一步的控制台上,我收到一条错误消息“不存在这样的部署方法。”

我能够通过 FTP 推送内容,但我想了解为什么应用服务发布不起作用,因为将来可能需要一些选项(如部署槽)。在这种情况下,使用 Azure 资源管理器连接会更好吗?还是我的构建工件毕竟需要压缩?如果必须将其压缩为 Web 部署,那么在构建解决方案之后是否有执行此操作的步骤,因为我必须首先将文件复制到工件文件夹中进行转换,所以我不能只进行全面的 Web 构建/压缩.

【问题讨论】:

  • 这个问题怎么样?下面的答案是否解决了您的问题?如果您有任何疑虑,请随时在此处分享。
  • @KenMcAndrew 如果我的回答对你有帮助,你可以考虑投票吗?

标签: azure-devops msbuild azure-pipelines-release-pipeline


【解决方案1】:

我没有看到您的管道的详细信息,所以我会分享我的。我正在部署 zip 包:

Package or folder 对话框中我有:

我在我的管道中使用 YAML,但如果您想在经典管道中使用类似的内容,它很容易理解和遵循:

trigger: none
pr: none

pool:
  vmImage: 'windows-latest'

variables:
  buildConfiguration: 'Release'
  projectDirectory: 'app-service-deployment-to-slot-with-preview\hadar'

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

- task: DotNetCoreCLI@2
  displayName: Publish
  inputs:
    command: publish
    publishWebProjects: false
    projects: '$(projectDirectory)\hadar.csproj'
    arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
    zipAfterPublish: true

- task: CopyFiles@2
  displayName: 'Copy configuration settings checks'
  inputs:
    contents: app-service-deployment-to-slot-with-preview\scripts\**
    targetFolder: '$(Build.ArtifactStagingDirectory)\scripts'
    flattenFolders: true

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifacts'

【讨论】:

    猜你喜欢
    • 2017-11-27
    • 1970-01-01
    • 2020-07-07
    • 2018-01-12
    • 2020-02-10
    • 1970-01-01
    • 2020-05-18
    • 2018-11-29
    • 1970-01-01
    相关资源
    最近更新 更多