Copy File task failed with the error of Unhandled: Not found SourceFolder
Asked Answered
U

1

6

I am very new CI/CD domain of Aure Dev Ops. So I Created a test ASP.NET MVC application. I checkedin the application in git repo at visual studio online. My build pipeline is working fine, but the ms build configuration of where my published files will be, seems to be not found. here is my msbuild configuration in my yml file:

msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'

And in my release pipeline, I am using a copy task with the following yml

steps:
- task: CopyFiles@2
  displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)/deploy'
  inputs:
    SourceFolder: '$(build.artifactStagingDirectory)'
    TargetFolder: '$(Build.ArtifactStagingDirectory)/deploy'

and this is the error I get when I try to deploy the release:

 ##[error]Unhandled: Not found SourceFolder: D:\a\r1\a\$(build.artifactStagingDirectory)
Uncommunicative answered 19/10, 2019 at 10:48 Comment(0)
H
8

Build.ArtifactStagingDirectory doesn't exist in a release pipeline. You need to use a Publish Build Artifacts task in your build pipeline, then download the artifacts using the Download Build Artifacts task in your release pipeline.

Heartbreaker answered 19/10, 2019 at 12:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.