Using appsettings.json in Class file in dotnet core
I was trying to add configuration in my class library file . Since the appsettings.json was not generated during creation of class library project I added it manually. After building the project I tried to run it but faced the issue that appsettings.json file is not present in the folder.
I am creating a solution which is having one project in ASP.NET Windows Service and the other project is ASP.NET Core Class Library.
What should be the best way to add configurations for the class library?
The base sdk itself does not do anything for the appsettings.json file. The web sdk, which is used by web projects, has an implicit content include for all json files: https://github.com/aspnet/websdk/blob/f8618af394cd0256c661223134d378595420e85a/src/ProjectSystem/Microsoft.NET.Sdk.Web.ProjectSystem.Targets/netstandard1.0/Microsoft.NET.Sdk.Web.ProjectSystem.props#L32
During publish, the json files will be placed in the publish folder. I imagine you could do something similar for your library, if you so desire.