Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

launchsettings.json, appsettings.json, web.config

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?

like image 984
newbeedeveloper Avatar asked Oct 26 '17 13:10

newbeedeveloper


People also ask

How do I change json launchSettings?

You can directly edit the launchSettings. json file in Visual Studio for Mac, or you can use project options to edit it. To get to the project options, right-click your project and select Options. Select Run > Configurations > Default.

What is launchSettings json?

The launchSettings. json file is used to store the configuration information, which describes how to start the ASP.NET Core application, using Visual Studio. The file is used only during the development of the application using Visual Studio. It contains only those settings that required to run the application.

Do I need launchSettings json?

The most important point that you need to keep in mind is this launchSettings. json file is only used within the local development machine. That means this file is not required when we publishing our asp.net core application to the production server.

Is launchSettings json used in production?

Visual studio maintains a file called launchSettings. json in a folder called Properties. This file contains various options for launching your app. launchSettings is used only by visual studio - it is never deployed to a production server.


1 Answers

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.
like image 117
Ignas Avatar answered Sep 17 '22 01:09

Ignas