Azure管道:找不到要上传的任何文件

时间:2019-12-16 16:51:11

标签: msbuild azure-devops azure-pipelines

我对天青管道还很陌生,
构建成功后,我创建了一个管道脚本以将文件复制到ftp,

1. Install Nuget packages
2. Build the Project
3. Copy built files to FTP

但抛出该错误找不到任何文件上传错误

    trigger:
    - master

    pool:
      vmImage: 'windows-latest'

    variables:
      solution: '**/*.sln'
      buildPlatform: 'Any CPU'
      buildConfiguration: 'Release'

    steps:
    - task: NuGetToolInstaller@1

    - task: NuGetCommand@2
      inputs:
        restoreSolution: '$(solution)'

    - task: VSBuild@1
      inputs:
        solution: '$(solution)'
        msbuildArgs: '/p:SkipInvalidConfigurations=true /p:AppxPackageDir="$(build.artifactStagingDirectory)" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=SideloadOnly'
        platform: '$(buildPlatform)'
        configuration: '$(buildConfiguration)'

    - task: FtpUpload@2
      inputs:
        credentialsOption: 'inputs'
        serverUrl: 'ftp://ba.foobar.com'
        username: 'Nitin'
        password: 'XKCD'
        rootDirectory: '$(build.artifactStagingDirectory)'
        filePatterns: '**'
        remoteDirectory: '/upload/$(Build.BuildId)/'
        enableUtf8: true
        clean: false
        cleanContents: false
        preservePaths: true
        trustSSL: true

感谢帮助

1 个答案:

答案 0 :(得分:1)

VSBuild中的参数AppxPackageDir,AppxBundle和UapAppxPackageBuildMode实际上都是UWP app的唯一参数,您可以在Set up automated builds for your UWP app中找到更多信息。请确保您的项目是UWP应用。

但是,如果它是Asp.net Core应用程序,我们可以在“编辑”历史记录中看到它。对应的应该是:  msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'。请更新您的代码,然后尝试一下。