Search code examples
c#asp.netwebformsdapper.net-4.6.1

Could not install Dapper 2.0.4 on .Net 4.6.1


I'm trying to install Dapper 2.0.4 via nuget manager as i want to use the latest Dapper.Contrib features It didn't proceed due to the following error:

Could not install package 'Dapper 2.0.4'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6.1', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

If i install the lower version (1.6), the installation went successful but i can't use the latest Contrib features.

How can i resolve this?

Hoping for your kind help. Thank you.


Solution

    1. Install .Net Framework SDK version 4.7.1 minimum.
    2. Select installed target as a Target Framework for all Projects in your Solution (in Project properties).
    3. Retarget all packages in all projects executing update-package -reinstall -ignoreDependencies from the Package Manager Console.
    4. Install Dapper.

    UPDATE (from comments):

    Dapper needs .NET Standard 2.0. Please retry the whole procedure including re-targeting with .NET Framework 4.7.2 as this is the first fully compliant with. Source: weblog.west-wind.com/posts/2019/Feb/19/