Error finding appsettings.Production.json when connecting via parameterless constructor
Error finding appsettings.Production.json
when connecting via parameterless constructor. Works if I enter appsettings.json
, but fails with any other filename.
Note that in the error it states: FileNotFoundExecption The configuration file 'appsettings.json' was not found
but the path I entered was appsettings.Production.json
LinqPad Version:v6.11.11 (X64) Licensed
Host runtime version: 3.1.11
Default query runtime version: 5.0.2
Default query reference assembly version: 5.0.0
Roslyn Version: 3.8.0-5.20562.2
FSharp.Compiler.Service version: 22.0.3.0
NuGet client version: 5.6.0.5
Accessing .net core 3.1project
Comments
By specifying the path to a configuration file, you're simply telling LINQPad to copy that file into the output folder so that it can be found by your context.
Do you have any code in your context like this?
If so, can you post that code?
No, because the default builder (Host.CreateDefaultBuilder) adds
appSettings.json
,appSettings.Production.json
andappSettings.Development.json
under the hood.What I am trying to do is create two different connections, one for production and one for development, based on the ConnectionStrings in the
appSettings.Production.json
andappSettings.Development.json
.In the screen shots above, you can see my path is directly to
appSettings.Production.json
, but the error message states it can't findappSettings.json
in the temp directory... but I didn't set that in the field, I typedappSettings.Production.json
!