Cataster
Cataster

Reputation: 3541

Why are the Web.*env*.config files not being copied over to the artifact?

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

Upvotes: 1

Views: 828

Answers (1)

JukkaK
JukkaK

Reputation: 1175

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).

Upvotes: 1

Related Questions