37

Is the launchsettings.json meant to be used in production or is it only for development purposes?

The one that is created by default has ASPNETCORE_ENVIRONMENT set to Development and also a localhost applicationUrl. Am I suppose to create separate production/staging profile or is this more of a development tool?

Gustav
  • 3,408
  • 4
  • 24
  • 41
  • Look at this https://stackoverflow.com/questions/41546943/how-to-set-aspnetcore-environment-to-be-considered-for-publishing-an-asp-net-cor – Murat Güzel Mar 22 '19 at 08:16
  • 5
    No, it's not used in production. The file itself is picked up by things like `dotnet run` and Visual Studio. – Kirk Larkin Mar 22 '19 at 08:20
  • ok, so would it be correct to say that it is for development use? – Gustav Mar 22 '19 at 08:22
  • Yes it would be correct. – Kirk Larkin Mar 22 '19 at 08:22
  • Then why does the documentation here https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-apache?view=aspnetcore-6.0#publish-and-copy-over-the-app ask us to modify the `launchSettings.json`? – variable Jan 14 '22 at 13:54
  • @variable because that is a section that starts "If the app is run locally in the Development environment". On the same page [here](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-6.0#lsj) it states, "The launchSettings.json file: *Is only used on the local development machine *Is not deployed." – Reg Edit Jul 14 '22 at 09:05
  • Ok I wasn't expecting something about development environment to be mentioned in the deployment documentation. – variable Jul 14 '22 at 09:52

1 Answers1

50

The launchSettings.json file is only used by Visual Studio during debugging and when running the app via dotnet run command.

See the quote from the official documentation:

The launchSettings.json file:

  • Is only used on the local development machine.
  • Is not deployed.
  • contains profile settings.

So for everyone who is looking for the short confirmed answer:

No, it's not used in production.

Siarhei Kavaleuski
  • 1,450
  • 14
  • 15
  • Then why does the documentation here https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-apache?view=aspnetcore-6.0#publish-and-copy-over-the-app ask us to modify the `launchSettings.json`? – variable Jan 14 '22 at 13:51
  • @variable it says 'If the app is run locally' – Alexander Derck Mar 04 '22 at 13:27
  • What's this instruction doing in deployment document? Does it mean run locally behind reverse proxy? Or as a developer? – variable Mar 04 '22 at 18:04
  • @variable you asked about the same thing in the question ccomments and I have continued the discussion there. – Reg Edit Jul 14 '22 at 09:15