Building asp.net core application

Hi,
If I create a new asp.net core api application, when I build it doesnt copy the appsettings.json files to the bin/debug folder.

Cheers,
John

Is it set to be copied?

Is this surfaced in the UI ?

I dont believe so, but you’d want <CopyToOutputDirectory>Always or <CopyToOutputDirectory>PreserveNewest as metadata flag on the file, to have it copied. Was this fie added by the template (if so I should fix the template) our did you manually add it?

It was added by the template.

1 Like

What about appsettings.Development.json, you need that copied too, by default?

Probably. That was my next question :slight_smile:
I havent read how that works.

Fixed. I’ll also log an issue for exposing there setting in the UI

Thanks, logged as bugs://84088

Oops, actually was already logged as 81866: Fire: expose "CopyToOutputDirectory" option in UI

And done, for today’s build.

1 Like

Thanks, that works great.

1 Like

Is this application type specific ? I created a .net and core console applications and set it but neither appear to be copying.

I should show regardless of project, but only for files with None or Content as build action/type. (for oder types, you can/will need to set it manually in the project file, or change the action, then set Copy, and then set the action back — since consider that a super corner-case ).

Oh wait, you mean you don’t see the action, to it doesn’t work when you set it? In the latter case — it should work in ay project type (in fact, I tested with an (ASP).NET Core one. I’d need a concrete testcase. thanx!

I mean I saw the action, set it and it doesn’t work.
DependencyInjection.zip (80.6 KB)

Odd. I’ll have a look.

Ah oops. that should be CopyToOutputDirectory not CopyToOutput ;). Fire adds the tag wrong, fixed

That explains how its working, I have the value twice

<None Include="appsettings.json">
  <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  <CopyToOutput>PreserveNewest</CopyToOutput>
</None>

I had already edited the file myself

1 Like