-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The configuration file 'appSettings.json' was not found ASP.NET core #157
Comments
Are you getting this error whilst running on linux? Because the line here has a capital 'S', running my app in linux (.net core) causes this issue. I would say, changing it the following line of code from "appSettings" to "appsettings.json" will make it work on linux. Otherwise, you could rename your appsettings to have the weird capitalisation... but I suspect it was not intentional.
|
I'm running on Mac but the application is running in a case insensitive file system so I don't think it's related to the casing. I'm primarily developing with ASP.NET and specifying a file name explicitly this way is generally not necessary. Is there another standard way of getting the settings without having to specify a file name? Program.cs
Startup.cs
|
This is happening for me on Linux. ASP.NET's built in configuration resolution expects appsettings.json (in the decompiled source) but the this library expects appSettings.json. So at least on linux, the casing is problem, especially if you develop on a case insensitive file system, like those on Windows, but deploy to Unix. |
I'm getting this error when I'm doing F5 debugging of my ASP.NET Core app in Visual Studio (Windows). I've checked the directory referenced in the exception and there is no appSettings.json. But I thought during local development the appSettings.json was read from the source root not from the bin directory? |
Try running dotnet run inside .csproj dir. The Directory.GetCurrentDirectory() and .SetBasePath(builderContext.HostingEnvironment.ContentRootPath paths are apparently relative to the folder where the command is run, instead of where the Program.cs file is located at. |
I was having the same error and I am using only the terminal, I just added the following group in my .csproj and it worked <ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup> *.csproj <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.7">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0-preview.5.23280.8" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.4" />
</ItemGroup>
<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
Even after a long time it's hard to find the solution, hope this helps someone somehow |
I am running an ASP.NET core application. My current settings file being used is appsettings.Development.json and configuration for the rest of my application is loading just fine from there.
However I am getting the message The configuration file 'appSettings.json' was not found
/Users/richardcollette/code/projectNameRoot/service/Dotted.Project.Name/bin/Debug/netcoreapp2.0/appSettings.json
It is however in the folder /Users/richardcollette/code/projectNameRoot/service/Dotted.Project.Name/bin/Debug/netcoreapp2.0/publish
Note the additional folder path of publish.
So two problems. It's not picking up the current executable path and second, it's not picking up the Development version.
I saw closed issue for this but this is ASP.net and also I have the concern about it not picking up the correct environment appsettings file.
If the rest of my application is picking up the configuration correctly, it would seem that perhaps the property accessor being used is too low level?
Is there a way to load my own list of settings (GetSection?) and pass them in to a feature FlagConfigurer?
The text was updated successfully, but these errors were encountered: