1

I'm finding something strange with the copy task in the build CI pipeline of a .NET app. lets call it JJ.

copy

For some reason, the Web.Dev.config, Web.Test.config, and Web.Prod.config files aren't being copied to the artifact. I have another pipeline for a similarly designed app so the pipeline is setup the same way, and I confirmed that with that other app, let's call it EE, those files are getting copied in the artifact, but with JJ they are not being copied for some reason.

EE app artifact (other app that copy task is working):

ee art

JJ app artifact (app in question, only Web.config is copied):

jj art

even though there is Dev/Test/Prod configs clearly in the directory

jj repo

jj log

JJ copy task YAML:

steps:
- task: CopyFiles@2
  displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)/Release'
  inputs:
    SourceFolder: '$(Build.ArtifactStagingDirectory)/_PublishedWebsites/JJDashboard'
    Contents: |
     assets/**
     bin/**
     Bundles/**
     Content/**
     Scripts/**
     Views/**
     Web.config
     Web.Dev.config
     Web.Test.config
     Web.Prod.config
     ApplicationInsights.config
     *.asax
     *.ico
     *.txt
    TargetFolder: '$(Build.ArtifactStagingDirectory)/Release'

EE copy task YAML (the app that config files are being copied just fine):

steps:
- task: CopyFiles@2
  displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)/Release'
  inputs:
    SourceFolder: '$(Build.ArtifactStagingDirectory)/_PublishedWebsites/EEDashboard'
    Contents: |
     assets/**
     bin/**
     Bundles/**
     Content/**
     Scripts/**
     Views/**
     Web.config
     Web.Dev.config
     Web.Test.config
     Web.Prod.config
     ApplicationInsights.config
     *.asax
     *.ico
     *.txt
    TargetFolder: '$(Build.ArtifactStagingDirectory)/Release'

The copy task YAMLs are pretty identical as you can observe, as is the repo structures/file locations. So why is it working for EE but not JJ?


Edit

Comparing JJ .csproj file vs EE .csproj file we observe the web.dev.config, web.test.config, and web.prod.config file references in JJ .csproj file are missing the tag: <content Include>

ee vs jj

Enabling this property for the files in the project resolves the issue:

property

halfer
  • 19,824
  • 17
  • 99
  • 186
Cataster
  • 3,081
  • 5
  • 32
  • 79

1 Answers1

1

Check that the new web.env.config -files are included in the JJDasboard-project .csproj (or .sln) -file, so they will be published with the build results.

The most apparent problem would be that the builds produce different results, ie. EE app's build copies all the different configs to output directory, where as JJ app's build only copies the web.config (as it does by default).

JukkaK
  • 1,105
  • 5
  • 15
  • is there a task i can insert to check the directory to output whats in there before the copy task? – Cataster Oct 25 '21 at 14:13
  • 1
    You can use tree command https://stackoverflow.com/a/63129192/6334351 – Kontekst Oct 25 '21 at 17:06
  • Thank you, so the results returned everything BUT the web.*env*.config. the Web.Dev.config, Web.Test.config, and Web.Prod.config are not showing up despite being in the repo...the thing is Web.Release.config and Web.Debug.config are also in the repo, in the same directory…so if they are showing up, the other configs should also show up… – Cataster Oct 26 '21 at 21:20
  • Check the csproj- or sln-files for the project that works and wheter those environment-specific configs files are included in the build results there. If yes, add the same includes to this project as well. – JukkaK Oct 28 '21 at 09:41
  • @JukkaK that was exactly the issue! The files were tagged in .csproj file as `` instead of ``. Do you want to edit your answer to provide some more context for future visitors? Ive included a screenshot in my post if you'd like to include that :) – Cataster Nov 03 '21 at 06:00
  • @Cataster Edited the answer, though your edit in the question is quite clear. – JukkaK Nov 03 '21 at 07:44