Skip to content

[Configuration] appsettings.json in Shared project set to Content doesn't get loaded when UseConfiguration and ContentSource is used #1497

@HakanL

Description

@HakanL

Current behavior

Following the new Uno templates I wanted to take advantage of the Uno Extensions Configuration service. The default is to use an embedded configuration file, which works fine, but for my purpose I want it to exist as a file in the deployment. I changed the build action on appsettings.json to Content. In the head I can confirm that it's stored in a subfolder called Shared (after the assembly where the json file resides). But the ContentSource doesn't find it. If I turn on logging then I can see it searches a couple of different folders, not where my app is. Either this is incorrect (bug), or there should be a way to specify the folder where ContentSource should expect the files (enhancement request).

Expected behavior

appsettings.json in Shared project set to Content should be loaded by UseConfiguration

How to reproduce it (as minimally and precisely as possible)

Change build action on appsettings.json to Content, change UseConfiguration to:

                    .UseConfiguration(configure: configBuilder =>
                        configBuilder
                            .ContentSource()
                            .Section<AppConfig>()
                    )

Environment

Nuget Package: Uno.Extensions.Configuration

Package Version(s): 2.3.11

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows
  • Linux

Visual Studio:

  • 2022

Anything else we need to know?

Tested and confirmed to not work in WinUI, Linux.Framebuffer and Windows.Gtk

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't workingpriority/backlogHigher priority than priority/awaiting-more-evidence.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions