.NET – Launch Settings (Basics)

What is the launchSettings.json file?
- Location:
Properties\launchSettings.json - Purpose: defines local run profiles — URLs, HTTPS, environment variables, and startup behavior.
- Important: used only during local development (
dotnet run, Visual Studio); does not affect production.
Key Fields
profiles– the collection of profiles (e.g.,http,https).commandName–Project→ runs the app directly with Kestrel (not IIS Express).applicationUrl– the URLs the app listens to (separated by;).environmentVariables– environment variables (e.g.,ASPNETCORE_ENVIRONMENT).launchBrowser– automatically opens the browser at startup (true/false).dotnetRunMessages– displays active URL messages in the console.
Your Profiles
Example minimal file:
1 | { |
http– listens only onhttp://localhost:5062.https– listens on bothhttps://localhost:7165andhttp://localhost:5062.- If you have
app.UseHttpsRedirection()inProgram.cs, thehttpprofile will automatically redirect to HTTPS.
👉 For normal development, use thehttpsprofile.
Link to the Code
The variable ASPNETCORE_ENVIRONMENT = Development activates conditional blocks such as:
1 | if (app.Environment.IsDevelopment()) |
How to Run with a Profile
CLI:
1 | dotnet run --launch-profile https |
Visual Studio / Rider / VS Code:
select the desired profile from the run dropdown.
Practical Tips
- Want local HTTPS? Install the development certificate:
1
dotnet dev-certs https --trust
- Changing ports? Edit
applicationUrland update your.httpor frontend config. - You can add custom variables:
1
2
3
4"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ConnectionStrings__Default": "Host=...;Database=...;"
}
Summary
- What it is: a launch profile configuration file used only in development (
Properties\launchSettings.json). - Used by:
dotnet run, Visual Studio, Rider, VS Code. - What it configures: URLs (
applicationUrl), environment variables (ASPNETCORE_ENVIRONMENT), startup options (launchBrowser). - What it doesn’t do: does not affect build/publish and is not used in production.
For production → useappsettings*.json, environment variables, and host configuration.
In short:launchSettings.json is a local development tool that defines how your .NET app runs on your machine — not where or how it will run in production.