ASP.NET 5, EF 7 and SQLite - compiler error CS1061

对着背影说爱祢 提交于 2019-12-13 07:16:05

问题


I have a ASP.NET 5 project in VS 2015 (Beta 8) that includes EF 7 which is working on Full-CLR but not Core-CLR. Below is the partial configuration:

"dependencies": {
    "EntityFramework.Commands": "7.0.0-beta8",
    "EntityFramework.SQLite": "7.0.0-beta8",
    "EntityFramework.SQLite.Design": "7.0.0-beta8"
}

services.AddEntityFramework()
    .AddSqlite();

When using the above and publishing to Docker I get the following error:

DNX,Version=v4.5.1 error CS1061: 'EntityFrameworkServicesBuilder' does not contain a definition for 'AddSqlite' and no extension method 'AddSqlite' accepting a first argument of type 'EntityFrameworkServicesBuilder' could be found.

If I remove the EntityFramework.SQLite.Design dependency it then works. I understand that EF 7 is still in beta and that the SQLite provider is incomplete, but is there a workaround? I don't plan to use migrations in Linux.

UPDATE

I was thinking that I could create an extension method to ensure a successful compilation, but this class wasn't recognized.

#if DNXCORE50
public static class SqliteEntityServicesBuilderExtensions
{
    public static EntityFrameworkServicesBuilder AddSqlite(
        this EntityFrameworkServicesBuilder services)
    {
        throw new NotImplementedException();
    }
}
#endif

回答1:


Microsoft found a bug concerning case-sensitive package names.

Changing the dependency from EntityFramework.SQLite.Design to EntityFramework.Sqlite.Design resolved the issue.



来源:https://stackoverflow.com/questions/33750255/asp-net-5-ef-7-and-sqlite-compiler-error-cs1061

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!