Home > other >  Can you change the location of launchSettings.json in an ASP.NET Core project?
Can you change the location of launchSettings.json in an ASP.NET Core project?

Time:01-24

In an ASP.NET Core project (created with dotnet new webapp), is it possible to change the location of launchSettings.json? Currently for it to be recognised I need to have it in a Properties/ folder, but I would like to rename this to have a lowercase 'p'.

As an extra point; would it also be possible to change the locations of the appsettings.json file(s)? Would I be able to put appsettings.json and appsettings.Development.json in another folder, for instance?

This question is almost what I'm looking for, but it was never answered.

CodePudding user response:

Unfortunately that path is hard coded in tools like dotnet-watch,

https://github.com/dotnet/sdk/blob/v7.0.102/src/BuiltInTools/dotnet-watch/LaunchSettingsProfile.cs#L29

var launchSettingsPath = Path.Combine(projectDirectory, "Properties", "launchSettings.json");

So, you have no flexibility changing it, not even changing the letter casing of P.

  • Related