Appa
Appa

Reputation: 507

ASP.NET Core publish and launch settings

I have a ASP.NET Core (v2.0) and I'm looking to retain my launchSettings.json properties across different environments.

The issue I'm experiencing is whenever I publish my project with dotnet publish, my artifacts folder containing the published output does not contain a launchSettings.json file. Does this compile into something else?

Upvotes: 11

Views: 13484

Answers (3)

Ihor Levchenko
Ihor Levchenko

Reputation: 41

You can use environment variable ASPNETCORE_URLS.

Example for Linux/Unix:

ASPNETCORE_URLS="http://0.0.0.0:5000" ./Release/netcoreapp3.1/WebApplication1

Upvotes: 1

Nguyễn Top
Nguyễn Top

Reputation: 372

launchSettings.json is a setting for IDE (Visual Studio, Visual Studio Code, Rider and so on), it's not used for release package.

In the launchSettings.json it has set up about the Environment Variable, Port and so on.

You can easier to change its (port, runtime config) on different Environment by "Computer Environment" and Command Parameters.

You can see more about the parameter or how it affects in Visual Studio.

If you actually wanna change the "setting for IDE" on difference Environment, it depends on how the IDE support you. I use Rider and it has setting for project/sln on different computer.

Upvotes: 4

Venkata Muttineni
Venkata Muttineni

Reputation: 86

Launch settings is will not be there in artifacts folder. It's a reference to solution environment variable. In cloud we can also say App Settings.

Upvotes: 1

Related Questions