launchsettings.json, appsettings.json, web.config

newbeedeveloper picture newbeedeveloper · Oct 26, 2017 · Viewed 19.8k times · Source

I have a couple of confusions:

  1. I published an ASP.NET Core project and I do not see launchsettings.json in bin\Release\PublishOutput. If I use Octopus, how do I configure attributes based on server type?

  2. Is it possible to move launchsettings.json to the root folder instead of under properties?

  3. If I want to use only one json like appsettings.json, can I merge both in the root folder?

  4. Can web.config be used instead of launchsettings.json, and how?

Answer

Ignas picture Ignas · Oct 27, 2017

Answers to your questions:

  1. As Chris Pratt mentioned in comment, launchSettings.json is only used by Visual Studio. You can use Octopus variables in Octopus.
  2. Don't need launchSettings.json for publishing an app.
  3. If there are settings that your application needs to use, please store them in appsettings.json. This will make deployments easier, since Octopus recognizes this file by default.
  4. It depends on your requirements. web.config is used by IIS, not by your .NET Core application directly, hence IIS limitations to what you can configure might be applied.

Hints.

  • If you have some environment specific variables, you can store them in environment specific appsettings.json, e.g. appsettings.Release.json.
  • You can leave placeholders for Octopus variable substitution in your appsettings.json file, especially in environment specific one, e.g. appsettings.Release.json may contain a config value like "#{ConnectionString}" and during deployment Octopus would substitute this placeholder with the actual value from Octopus variables.