0

I am using TFS 2018 on-prem to build by ASP.Net Core application. I use the Visual Studio Build task (Version 1.*) with no additional MSBuild arguments. That is I just build my project by pointing to the project.sln file.

The issue is I don't get my appsetting.*.json in my build results so that I can do transformations on it. Both on build agent and my result zip file do not have the JSON file.

In my csproj, I do have the following:

<ItemGroup> <Content Update="appsettings.json">
   <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content>  
   ... 
</ItemGroup>

When I build through VS2017, I do get my appsettings.json files copied to the bin folders. If I publish from my VS2017, I get the appsettings.json files in my published folder.

What am I doing wrong? How do I get the TFS to build tasks to copy my JSON files?

dpapadopoulos
  • 1,834
  • 5
  • 23
  • 34
Abdel Raoof Olakara
  • 19,223
  • 11
  • 88
  • 133
  • You should increase the verbosity of the build to diagnostic and see why that file is not getting copied. – C.J. Feb 20 '19 at 19:54

1 Answers1

2

By changing the appsetting.json to be an Embedded resource I solved my problem.

See this for the full answer. https://stackoverflow.com/a/49778593/375114

Atron Seige
  • 2,783
  • 4
  • 32
  • 39
  • I can confirm this. First I had the Build Action of appsettings.json defined as Content. The json file was not fetched by TFS during a build. First I solved this by choosing Clean Sources in Get sources, but this is not a real solution. With Build Action = Embedded Resource appsettings.json is always properly updated in a TFS build. – Vincent65535 Aug 11 '20 at 10:06