Questions tagged [microsoft.extensions.configuration]

13 questions
3
votes
1 answer

System.Configuration.ConfigurationManager vs Microsoft.Extensions.Configuration

I am working on a class library(.NET Standard 2.0) CL, which will be used by some of our legacy projects(.NET Framework 4.6.1) LP and many of our new implementations(.NET Core 3.1) NI. My class library CL needs some of the configuration settings but…
2
votes
0 answers

Polymorphic data in dotnet 7 configuration

I want to load polymorphic data from appsettings. This is a test setup. async Task Main() { var cfg = new { PolySection = new PolyCfg { Property = new List { new…
ZorgoZ
  • 2,974
  • 1
  • 12
  • 34
2
votes
0 answers

Newtonsoft.Json as configuration provider in ASP.NET (5+)

For better or worse our codebase relies heavily on Newtonsoft.Json. There are various type converters etc. based on this framework and it is simply not worth the effort to rewrite them using some other JSON framework (if even possible). We use…
1
vote
0 answers

Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces 6.0.0'

I'm trying to make the MSBuild plugin which will help to obfuscate the output file in seconds, I've run into a very weird error, which doesn't allows me to continue the development, the problem is some of the Nuget Packages asking me to use…
sunnamed
  • 96
  • 1
  • 10
1
vote
1 answer

How to read configuration that contains a "Name" attribute using Microsoft.Extensions.Configuration

I am trying to read a configuration in my application. Consider the code below...I load an XML in memory and it contains 3 different nodes. I can only get the value of the node with no Name attribute const string content = @"
FFMG
  • 1,208
  • 1
  • 10
  • 24
1
vote
2 answers

XML Config, How can I read a configuration file with a list/array of values rather than a single value

If I have a configuration file with the following list of values in the configuration. The configuration file is an xml file...
FFMG
  • 1,208
  • 1
  • 10
  • 24
1
vote
0 answers

Custom ConfigureOptions is not changing set options when Configure is called

I'm trying to create a custom ConfigureOptions class implementing IConfigureNamedOptions in .NET 4.8. Here is the implementation public class ConfigureAppSettings : IConfigureNamedOptions { private readonly IConfiguration…
1
vote
1 answer

Read JSON as string from Microsoft.Extensions.Configuration

Microsoft.Extensions.Configuration has its own API for navigating through the JSON contained in the config file it reads in. (This is what ASP.NET uses for configuration) For a given JSON node- is there a way to get access to its contents as a…
MgSam
  • 12,139
  • 19
  • 64
  • 95
0
votes
0 answers

How can I create a NuGet package that uses both .NET Framework and .NET Core configuration?

I'm trying to allow the constructor to accept IConfiguration for .Net, and a reference to ConfigurationManager or similar for .Net Framework/Standard. I am trying to create a conditional constructor for a class that needs to know which runtime it's…
0
votes
1 answer

How to read array configuration sections with binding?

How can I read an array of configuration values using Microsoft.Extensions.Configuration with binding? For example, given the following XML configuration:
0
votes
1 answer

I can't use SeBasePath anymore when adding custom json file into IConfigrutaion?

I have a Class Library project based on .NET 6. I'm trying to load a custom JSON configuration file, and either create/instance an IConfiguration instance based on that. I installed Microsoft.Extensions.Configuration version 5.0.0 The below code is…
0
votes
1 answer

How to read complex object from configuration file using microsoft.extensions.configuration

I have following configuration file { "MyNamespace.Plugin": { "Setting": { "Path": "test" } } } And wrote following code to read it var config = new ConfigurationBuilder() .AddJsonFile("settings.json") …
resp78
  • 1,414
  • 16
  • 37
0
votes
1 answer

ASP.NET Core ConfigurationProvider from database

I wonder if there is implemented ConfigurationProvider for ASP.NET Core which loads options from Database. EF or Dapper. It's fairly easy to implement ourselves, but I wonder if there is ready solution, and if this really a good idea.
Leotsarev
  • 1,040
  • 7
  • 23