【问题标题】:How to do dotnet publish in Build Yaml如何在 Build Yaml 中进行 dotnet 发布
【发布时间】:2019-08-21 14:58:03
【问题描述】:

如果需要在dotnet publish 中做一个测试项目.Net Core 2.1,你能否举例说明如何在build.yaml 中指定。转介this 想不通。

下面说,yaml方式应该是什么

要使此任务正常运行,您必须已使用 dotnet publish --output $(Build.ArtifactStagingDirectory) 命令将构建的输出发布到此目录。要在发布前将其他文件复制到此目录,

例如下面如何在build.yaml 中表示类应用程序(API 解决方案)

dotnet publish ~/projects/app1/app1.csproj

在下面尝试过

- task: DotNetCoreCLI@2
      displayName: "Prepare Publish Files"
      inputs:
        command: publish
        projects: ""
        arguments: --output $(Build.ArtifactStagingDirectory)/src/xxx.EndToEnd.Integration.Tests/xxx.EndToEnd.Integration.Tests.csproj

但出现以下错误,实际上我的是 API 解决方案,我正在尝试发布端到端测试并在部署后运行它们。

##[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.

【问题讨论】:

    标签: yaml azure-pipelines asp.net-core-2.1


    【解决方案1】:

    使用下面的YAML 代码我能够运行构建

    - task: DotNetCoreCLI@2
      displayName: "dotnet e2e tests"
      inputs:
        command: publish
        publishWebProjects: false
        projects: '**/*.csproj'
        arguments: --output $(Build.ArtifactStagingDirectory)/src/xxx.EndToEnd.Integration.Tests
        zipAfterPublish: false
    

    解释:

    publishWebProjects: false - 因为这是一个 API 解决方案。

    简单的方法是在设计器向导中创建任务并在那里查看 YAML 文件(单独的选项卡以显示 yaml 文件)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-10
      • 1970-01-01
      • 1970-01-01
      • 2018-01-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-20
      相关资源
      最近更新 更多