I find this relatively known GitHub repository, where they considered launchSettings.json
file (which is used by Visual Studio 2017 for .Net Core projects) is to be ignored.
https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
Why should it be ignored? I used always in the company I work in to commit it, I am curious to know if there is any reason to ignore it.
launchSettings.json
should not be ignored. That repository has since been updated to not ignore it: https://github.com/github/gitignore/pull/2705
Reasons for making this change:
Ignoring
launchSettings.json
does not make much sense. Now .NET CLI even considers this file when running withdotnet run
, as you can read here.This settings will be useful if shared among project members, so it should be commited to the repo.
Links to documentation supporting these rule changes:
https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-run?tabs=netcore2x
One reason that this might be done as a general practice is to keep secrets out of the repo.
If you're using environment variables to store DB passwords, API keys, and so on, you can configure those for your dev hosting environment under Project Properties -> Debug, as key-value pairs.
That configuration gets persisted locally in the project's launchSettings.json
, so by keeping that file out of commits you avoid leaking privileged information into your repo.
Note though, that the current best practice is not to store secrets in this way at all during development, but to use the Secrets Manager instead.
OK now I know why, I deleted that file, but the options of this project are still saved somewhere there, the options simply did not get lost after deleting this file. The file seems to be automatically generated when I do any new change to the project options, so my old version with the new changes is going to be there again.
I am not sure what is the benefit of it in this case, but at least I can say we can probably exclude it from the source control.
Please correct me if I missed anything.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With