How can I ensure that appsettings.dev.json gets copied to the output folder?

If you want to copy a file to your output folder you can add this to your csproj file:

<ItemGroup>
   <None Update="appsettings.IntegrationTests.json">
     <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
   </None>
</ItemGroup>

This works with dotnet build/test/run vscode & visual studio

Leave a Comment