Problems in Dapper and MVC VNext

asp.net-core-mvc dapper

Question

I created an class library for tests of an ASP.NET MVC VNext project.

In this class library I am using Dapper so I have the project.json:

{

  "dependencies": {
    "xunit": "2.1.0-beta2-*",
    "xunit.runner.dnx": "2.1.0-beta2-*",
    "Dapper": "1.42.0"
  },

  "commands": {
    "test": "xunit.runner.dnx"
  },

  "frameworks": {

    "dnx451": {
      "dependencies": {
        "Dapper": "1.42.0"
      }
    },

    "dnxcore50": {
      "dependencies": {
        "System.Collections": "4.0.10-beta-22816",
        "System.Linq": "4.0.0-beta-22816",
        "Microsoft.CSharp": "4.0.0-beta-22816",
        "Dapper": "1.42.0"
      }
    }

  }
}

I keep getting the error:

The type or namespace name 'Dapper' could not be found (are you missing a using directive or an assembly reference?)    MvcProj.Test.DNX Core 5.0   

How can I fix this?

Popular Answer

Use a beta version of Dapper

Since dnxcore50 is still in beta, none of the release versions of Dapper can claim release support for it it yet. That's why the Dapper guys aren't putting it in the release packages.

DNX beta support is available in the beta versions of Dapper. Try using version 1.41.0-beta5, or whatever the latest non-release version is in their nuget feed.

"dependencies": {
    //...
    "System.Data.SqlClient": "4.0.0-beta-23225",
    "Dapper": "1.41.0-beta5"
},

I'm using this in my applications right now and it seems to work well.




Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why