user989988
user989988

Reputation: 3746

dotnet build failing because project not found

I have a YAML file with tasks to copy & publish files to artifact and download the artifact:

Log for task DownloadPipelineArtifact@2:

Downloading: D:\a\1\s\Service\ProjectName\Repositories.Logging/Repositories.Logging.csproj

Then, I have a task to build. The build fails on this task.

Log for task DotNetCoreCLI@2:

Skipping project "D:\a\1\s\Service\ProjectName\Repositories.Logging\Repositories.Logging.csproj" because it was not found.

Why does it say skipping project because it was not found even though log for DownloadPipelineArtifact@2 shows the same path? What am I missing and how do I fix that?

UPDATE:

I know that there is a difference in the slashes. However, I don't have conrol over updating the slashes:

Tasks to copy, publish, download:

    - task: CopyFiles@2
      displayName: 'copy service'
      inputs:
        SourceFolder: 'Service\ProjectName'
        contents: '**'
        TargetFolder: '$(build.artifactstagingdirectory)'

    - task: PublishBuildArtifacts@1
      displayName: 'publish artifact'
      inputs:
        PathtoPublish: '$(build.artifactstagingdirectory)'        
        ArtifactName: '$(Build.BuildNumber)'

    - task: DownloadPipelineArtifact@2
      inputs:
        artifactName: '$(Build.BuildNumber)'
        downloadPath: Service\ProjectName

On updating download task to:

    - task: DownloadBuildArtifacts@0
      inputs:
        artifactName: '$(Build.BuildNumber)'
        downloadPath: $(System.DefaultWorkingDirectory)\Service\ProjectName

I see the following log from DownloadBuildArtifacts@0:

Downloaded to D:\a\1\s\Service\ProjectName\20201118.10\Repositories.Logging\Repositories.Logging.csproj

and following log from DotNetCoreCLI@2:

D:\a\1\s\Service\ProjectName\Repositories.Logging\Repositories.Logging.csproj because it was not found

In this case I see the slashes correctly. Is it possible to remove:

20201118.10

from downloadPath so that it becomes:

D:\a\1\s\Service\ProjectName\Repositories.Logging\Repositories.Logging.csproj

Upvotes: 0

Views: 729

Answers (1)

Leo Liu
Leo Liu

Reputation: 76928

Is it possible to remove 20201118.10 from downloadPath.

We could not remove the artifact Name 20201118.10 when we use the task Download build artifacts.

When we check the task Download build artifacts in the classic mode, we could to know the option Artifact name is required:

enter image description here

To resolve this issue, we could add a copy task to copy files to $(System.DefaultWorkingDirectory)\Service\ProjectName folder

- task: CopyFiles@2
  displayName: 'Move artifact Name'
  inputs:
    SourceFolder: '$(System.DefaultWorkingDirectory)\Service\ProjectName\$(Build.BuildNumber)'
    TargetFolder: '$(System.DefaultWorkingDirectory)\Service\ProjectName'

Or you could specify the path including the artifact Name 20201118.10 when you build the project:

- task: DotNetCoreCLI@2
  displayName: 'dotnet build'
  inputs:
    projects: '$(System.DefaultWorkingDirectory)\Service\ProjectName\$(Build.BuildNumber)\Repositories.Logging\Repositories.Logging.csproj'

Upvotes: 1

Related Questions