3

I have a solution in Visual Studio consisting of multiple report projects, and using Azure Pipelines to deploy the reports to my report server. This pipeline has served me faithfully for years, but my goal is to simplify it a bit.

Running MSBuild for the solution generates a directory structure like this:

- root
  - Project A
    - bin
      - Release
        - Report1.rdl
        - Report2.rdl
  - Project B
    - bin
      - Release
        - Report3.rdl
        - Report4.rdl

Question: how can I use either the Copy Files task in my pipeline or a subsequent PowerShell task to produce a slightly flattened structure like this, where the bin and Release folder for each project is removed?:

- root
  - Project A
    - Report1.rdl
    - Report2.rdl
  - Project B
    - Report3.rdl
    - Report4.rdl

Here is an outline of my current pipeline configuration:

- Build solution
  - MSBuild arguments: none
  - Configuration: $(BuildConfiguration)
- Copy files
  - Source folder: $(build.sourcesdirectory) 
  - Contents: **\bin\$(BuildConfiguration)\**\*.rdl
  - Target folder: $(Build.ArtifactStagingDirectory)
- Publish artifact
  - Path to publish: $(Build.ArtifactStagingDirectory)

enter image description here

Angler
  • 78
  • 1
  • 6

1 Answers1

3

You can use something like that:

- Build solution
  - MSBuild arguments: none
  - Configuration: $(BuildConfiguration)
- Copy files
  - Source folder: $(build.sourcesdirectory) 
  - Contents: **\Project A\bin\$(BuildConfiguration)\*.rdl
  - Target folder: $(Build.ArtifactStagingDirectory)\Project A
  - Flatten Folders: True
- Copy files
  - Source folder: $(build.sourcesdirectory) 
  - Contents: **\Project B\bin\$(BuildConfiguration)\*.rdl
  - Target folder: $(Build.ArtifactStagingDirectory)\Project B
  - Flatten Folders: True
- Publish artifact
  - Path to publish: $(Build.ArtifactStagingDirectory)

The Flatten folders option here:

enter image description here

OR

- Build solution
  - MSBuild arguments: none
  - Configuration: $(BuildConfiguration)
- Copy files
  - Source folder: $(build.sourcesdirectory)\Solution Folder\Project A\bin\$(BuildConfiguration) 
  - Contents: *.rdl
  - Target folder: $(Build.ArtifactStagingDirectory)\Project A
- Copy files
  - Source folder: $(build.sourcesdirectory)\Solution Folder\Project B\bin\$(BuildConfiguration) 
  - Contents: *.rdl
  - Target folder: $(Build.ArtifactStagingDirectory)\Project B
- Publish artifact
  - Path to publish: $(Build.ArtifactStagingDirectory)
Shamrai Aleksander
  • 13,096
  • 3
  • 24
  • 31
  • Thanks! This is one approach I had considered. The issue is that the solution consists of over a dozen projects, so I will need to configure a Copy Files task for each project. – Angler Dec 01 '21 at 12:21
  • @Angler were you able to find a solution to what you were looking for? – user2386411 Jun 10 '22 at 01:27