Hi,
Just want to give my two cents for when others end up here wondering how to pack the appsettings.json file in their deployable xll.
The described latter solution did seem to work for me running from VS, but when building, packing and deploying the solution, it no longer did.
After quite some searching in unknown territory and serendipitously running into
AddJsonStream(), I went for embedding the appsettings.json file as an embedded resource, reading it as a stream and then using that with the help of AddJsonStream() (as part of Microsoft.Extensions.Configuration.Json package):
```
ConfigFiles files = new();
string contents = files.File("appsettings);
// get the file's content as a string - I had this already setup, rahter than as a stream
byte[] byteArray = Encoding.UTF8.GetBytes(contents); // convert to bytes
MemoryStream stream = new(byteArray); // convert to Stream
IConfiguration config = new ConfigurationBuilder()
.AddJsonStream(new MemoryStream(byteArray))
.Build();
```
Hope it may help anybody.
KR. Oscar
Op dinsdag 27 september 2022 om 05:06:42 UTC+2 schreef Andy Sprague: