During a painful switch from .NET Framework 4.6 to 4.8 I encountered this error:

Error CS1061 'IMemberConfigurationExpression' does not contain a definition for 'UseValue' and no accessible extension method 'UseValue' accepting a first argument of type 'IMemberConfigurationExpression' could be found (are you missing a using directive or an assembly reference?)

This comes from AutoMapper and it seems that at some point (version 8.0) that things changed which we can find in their pleasantly useful documentation. To save you the trouble here’s the links:

In my case I had two changes:

First ResolveUsing see this link

To migrate, replace all usages of ResolveUsing with MapFrom.

And second UseValue see this link

This can be simplified to a global find and replace of UseValue( with MapFrom(src =>

Note that AutoMapper stopped supporting .NET Framework 4.8 and that 10.1.1 seems to be the last working version that does (thanks StackOverflow!)

Last modified: April 27, 2023

Author

Comments

Write a Reply or Comment

Your email address will not be published.