asp.net-core-3.0custom-model-binder

asp.net core 3.0 IModelBinder


IModelBinder does not get recognized and compile with only asp.net core 3.0 (netcoreapp3.0) installed untill Microsoft.AspNetCore.Mvc.2.2.0 nuget is installed and the version 3.0 nuget is not available for the same.

Is it fine to include 2.2.0 nuget with asp.net core 3.0 app? Or am I missing something.


Solution

  • I was building a utility class library. Default asp.net core template adds the reference without mentioning it in ItemGroup.

    In a class library, adding the below in project file resolves the issue.

    <ItemGroup>
        <FrameworkReference Include="Microsoft.AspNetCore.App" />
    </ItemGroup>