IConfiguration does not contain a definition for GetValue

September 26, 2020

When I search for something, I typically start with pmichaels.net [tab] [search term] - especially if I know I’ve come across a problem before. This post is one such problem: it’s not hard to find the solution, but it is hard to find the solution on this site (because until now, it wasn’t here).

The error (which is also in the title):

IConfiguration does not contain a definition for GetValue

Typically appears when you’re using IConfiguration outside of an Asp.Net Core app. In fact, GetValue is an extension method, so the solution is to simply add the following package:



Install-Package Microsoft.Extensions.Configuration.Binder

References

https://stackoverflow.com/questions/54767718/iconfiguration-does-not-contain-a-definition-for-getvalue



Profile picture

A blog about one man's journey through code… and some pictures of the Peak District
Twitter

© Paul Michaels 2024