I have an ASP.NET Core 7 project deployed with GitHub Actions.
Internally the appsettings.Development.json
is pushed into Git as all the developers are using the same setting.
But this file is not needed on deployment and may cause an unintended behaviour if used by mistake or even if compromised.
I didn't find an option to filter out this file at GitHub Actions actions/checkout@v3
. We have also looked at an option to delete is with Jesse Remove but that didn't work and even if it works it would have been a patch rather than a proper solution.
Is there any solution to:
.csproj
or a similar settingOR
You can add this to your .csproj
to remove appsettings.Development.json
from publish:
<Project ...>
...
<ItemGroup>
<Content Update="appsettings.Development.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</Content>
</ItemGroup>
</Project>