My Minimal API project has 2 launchSettings.json files, which should it use?

Falanga, Rod, DOH 400 Reputation points
2025-10-17T17:28:51.22+00:00

I am refactoring a Blazor Web Application project, by migrating a Minimal API project out of it, into it's own Visual Studio project. I created the new project using Visual Studio's ASP.NET API template (I forget at the moment the correct name for the template). Then after doing that, I imported the Minimal API project out of the Blazor Web Application project into the new API project.

After doing that I discovered that the new VS project has two launchSettings.json files. One is at the root of the new API project. The other is in the Properties folder of the Minimal API project that I copied from the older Blazor Web Application project.

I am concerned that having 2 launchSettings.json files may interfere with the functioning of the new Minimal API application. My question is should I delete one of them? And if so, which one?

Developer technologies | .NET | Other
0 comments No comments
{count} votes

Answer accepted by question author
  1. Devy Jones 80 Reputation points
    2025-10-18T16:44:01.5666667+00:00

    In your case, yes — you should keep only one launchSettings.json file.

    Here’s the short explanation 👇

    The active launchSettings.json file for a .NET project is always the one inside the Properties folder of the project being built and launched. If there’s another copy at the project root, Visual Studio (and the .NET CLI) will ignore it, but it can cause confusion later.

    Solution:

    Keep the one in Properties/launchSettings.json.

    Delete the one at the project root to avoid conflicts.

    Then restart Visual Studio to ensure it reloads the correct launch profile.

    Regards: Muse Dash

    1 person found this answer helpful.
    0 comments No comments

Answer accepted by question author
  1. Bruce (SqlWork.com) 81,191 Reputation points Volunteer Moderator
    2025-10-18T16:38:27.82+00:00

    Vs will use the launch setting in the project properties folder. VS only uses these files when in development mode, they are not part of the deployed project. note: vs has blazor web application template that creates a webapi hosting project and blazor client project. Id use this instead, unless you are creating a separate webapi project from the blazor hosting project.

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. AgaveJoe 30,396 Reputation points
    2025-10-18T18:22:10.11+00:00

    The launchSettings.json file defines different profiles for running your application locally. It provides instructions used by both Visual Studio and the dotnet run command to specify how your project should be launched and debugged.

    If your Visual Studio solution contains multiple applications, you can configure them to launch simultaneously. To do this, right-click on the solution, select Properties, and under Startup Project, choose Multiple startup projects. From there, you can set the "Action" for each project to "Start" or "Start without Debugging."

    1 person found this answer helpful.
    0 comments No comments

  2. Adiba Khan 895 Reputation points Microsoft External Staff
    2025-10-20T10:12:38.8033333+00:00

    Thanks for reaching out it appears that your new minimal API project currently contains 2 launchSettings.json files-one at the root of the new API project and another inside the properties folder.

    Explanation

    Visual Studio uses the launchSettings.json file that resides in the properties folder of each project to configure how the project is launched (e.g., environment variables, URLs, and profiles).

    Having 2 launchSettings.json Files in different location can cause confusion, but only the one located under the properties folder of the current project is used by Visual Studio at build and runtime.

    Recommended action

    1.      keep only the launchSettings.json file located in the properties folder of your new minimal API project.

    2.      Delete or remove the extra:

    Launchsettings.json file exists at the root level of the project.

    ·         This extra file may have been copied over when you imported the minimal API project.

    ·         It is not recognized by Visual Studio and can safely be removed.

    Verification steps

    To verify the correct file is being used:

    1.      in Visual Studio, open the project properties-> debug tab.

    2.      Check the profiles listed there: they correspond to entries inside the active launchSettings.json (from the properties folder).

    3.      Run the project-Visual Studio should correctly apply the configuration from that file.

    Reference

    ASP.NET Core runtime environments | Microsoft Learn

    Aspire and launch profiles - Aspire | Microsoft Learn

    Let me know if you need any further help with this. We'll be happy to assist.

    If you find this helpful, please mark this as answered.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.