从Azure DevOps上传FTP的问题-没有上传文件

时间:2019-04-28 19:17:22

标签: azure-devops

我相信我的管道设置正常,但是FTP似乎没有上传任何文件。我已经列出了FTP日志以及我的YAML。

看来我的build.artifactstaging目录为空。

FTP消息:

##[section]Starting: FTP Upload: $(build.artifactstagingdirectory)
==============================================================================
Task         : FTP Upload
Description  : FTP Upload
Version      : 1.142.2
Author       : Microsoft Corporation
Help         : Upload files to a remote machine using the File Transfer Protocol (FTP), or securely with FTPS.  [More Information](http://go.microsoft.com/fwlink/?LinkId=809084).
==============================================================================
connecting to: api.xxx.com:21
connected: Microsoft FTP Service
uploading files to remote directory: /
files uploaded: 0, files skipped: 0, directories processed: 1, total: 1, remaining: 2, remote directory successfully created/verified: /
files uploaded: 0, files skipped: 0, directories processed: 2, total: 2, remaining: 1, remote directory successfully created/verified: /
files uploaded: 1, files skipped: 0, directories processed: 2, total: 3, remaining: 0, successfully uploaded: D:\a\1\a\xxx.API.zip to: /xxx.API.zip
FTP upload successful 
host: api.xxx.com
path: /
files uploaded: 1
files skipped: 0
directories processed: 2
disconnecting from: api.xxx.com
disconnected
##[section]Finishing: FTP Upload: $(build.artifactstagingdirectory)

但是我正在建立此目录。

我的YAML在下面:

steps:
- task: DotNetCoreCLI@2
  displayName: Restore
  inputs:
    command: restore
    projects: '$(Parameters.RestoreBuildProjects)'

- task: DotNetCoreCLI@2
  displayName: Build
  inputs:
    projects: '$(Parameters.RestoreBuildProjects)'
    arguments: '--configuration $(BuildConfiguration)'

- task: DotNetCoreCLI@2
  displayName: Test
  inputs:
    command: test
    projects: '$(Parameters.TestProjects)'
    arguments: '--configuration $(BuildConfiguration)'

- task: DotNetCoreCLI@2
  displayName: Publish
  inputs:
    command: publish
    publishWebProjects: false
    projects: '$(Parameters.RestoreBuildProjects)'
    arguments: '--configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory)'
    zipAfterPublish: True

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact: $(build.artifactstagingdirectory)'
  inputs:
    PathtoPublish: '$(build.artifactstagingdirectory)'
  condition: succeededOrFailed()

- task: FtpUpload@1
  displayName: 'FTP Upload: $(build.artifactstagingdirectory)'
  inputs:
    credentialsOption: inputs
    serverUrl: 'ftp://api.xxx.com'
    username: xxx
    password: ‘xxx’
    rootDirectory: '$(build.artifactstagingdirectory)'
    remoteDirectory: /
    preservePaths: true
    trustSSL: true

我将不胜感激。谢谢

1 个答案:

答案 0 :(得分:0)

似乎我需要在发布任务中取消选中这两个选项:

已发布的项目

添加项目名称以发布路径