'Single WCF project will not create build artifact under YAML Azure DevOps Build Pipeline

Our build pipeline includes a YML template that is used to build all of our WCF services and Web applications. For all of the WCF services but one, it works like a charm. For this one WCF service, however, the following output is generated in the build logs during the Publish Artifact stage:

##[warning]Directory 'D:\azagent\A2_work\1381\a' is empty. Nothing will be added to build artifact 'drop'.

Our Build stage invokes a separate YML file which includes the following to build and publish the project:

  - task: VSBuild@1
    displayName: "Build ${{ parameters.solution}}"
    inputs:
      solution: ${{ parameters.solution }}
      msbuildArgs: >
        /p:DeployOnBuild=true 
        /p:WebPublishMethod=Package
        /p:PackageAsSingleFile=true
        /p:SkipInvalidConfigurations=true
        /p:IgnoreDeployManagedRuntimeVersion=true 
        /p:PackageLocation="$(build.ArtifactStagingDirectory)"
      platform: ${{ parameters.buildPlatform }}
      configuration: ${{ parameters.buildConfiguration }}

  - task: PublishBuildArtifacts@1
    displayName: "Publish Build Artifact"
    inputs:
      PathtoPublish: "$(Build.ArtifactStagingDirectory)"
      ArtifactName: "drop"
      publishLocation: "Container"

As stated earlier, this works perfectly for all other WCF projects, and generates a build artifact. However, for the problematic WCF Service, no build artifact is generated. What we've observed is that no ZIP file is created in the D:\azagent\A2_work\1381\a folder (theoretically, Build.ArtifactStagingDirectory).

I have tried numerous recommended solutions to resolve this issue, all to no effect.

  1. Adding a CopyFiles@2 task between the VSBuild@1 task and the PublishBuildArtifacts@1 task did place the files in the Build.ArtifactStagingDirectory, but they were not in a ZIP file. Further, the deployment task (later in the pipeline) failed because no ZIP file was present in the drop folder.
  2. Adding /p:OutDir=$(Build.ArtfactStagingDirectory) did seem to produce some sort of artifact, but the deployment task still failed, claiming it could not find the ZIP file in the drop folder.
  3. I created a test repo that contained only the WCF project (as it's normally contained in a solution containing it and a Web application) and ran the pipeline against that repo. No build artifact was created.

Ultimately, nothing I do seems to be able to get this project to generate a build artifact.

What am I missing here? What further information can I provide that will help you to help me resolve this issue?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source