'IConfigurationSection' does not contain a definition for 'Get' and no accessible extension
Asked Answered
L

1

12

I created the JwtHelper class. I have been using it for a long time. However, when I updated the packages, I got an error in the following line;

Error Lines

The complete error message is as follows;

Severity Code Description Project File Line Suppression State Error CS1061 'IConfigurationSection' does not contain a definition for 'Get' and no accessible extension method 'Get' accepting a first argument of type 'IConfigurationSection' could be found (are you missing a using directive or an assembly reference?)

I found the solution. I'm writing here so you don't waste time.

Leekgreen answered 9/4, 2021 at 10:20 Comment(0)
L
42

Go to Nuget and download the "Microsoft.Extensions.Configuration.Binder" package.

enter image description here

Install-Package Microsoft.Extensions.Configuration.Binder -Version 5.0.0
Leekgreen answered 9/4, 2021 at 10:20 Comment(1)
I still can't understand why sometimes it perfectly works with just Microsoft.Extensions.Configuration, without a Binder package, but in other cases, Microsoft.Extensions.Configuration.Binder is the only way to fix a compiler error.Ihs

© 2022 - 2024 — McMap. All rights reserved.