0

私はこのコードを持っています:

using Microsoft.Extensions.Configuration;
using System;
using System.IO;
using System.Threading.Tasks;

var builder = new ConfigurationBuilder()
                .SetBasePath(Directory.GetCurrentDirectory())
                .AddJsonFile("appsettings.json");

var config = builder.Build();
var authenticationConfig = new AuthenticationConfig();
config.Bind(authenticationConfig);

私は得ています:

Severity    Code    Description Project File    Line    Suppression State
Error   CS1061  'IConfigurationRoot' does not contain a definition for 'Bind' and no accessible extension method 'Bind' accepting a first argument of type 'IConfigurationRoot' could be found (are you missing a using directive or an assembly reference?)    SandboxSecurityToken    C:\xxx\Program.cs   35  Active

既に Microsoft.Extensions.Configuration をインポートしました (参照: Microsoft.Extensions.Configuration の使用)。何が欠けている可能性がありますか?ありがとう!

4

1 に答える 1