本文介绍了ASP.NET 5,EF 7和SQLite-编译器错误CS1061的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VS 2015(测试版8)中有一个ASP.NET 5项目,其中包括可用于Full-CLR而不是Core-CLR的EF 7。以下是部分配置:

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();

使用以上内容并将其发布到Docker时,出现以下错误:

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

如果删除了EntityFramework.SQLite。然后就可以设计依赖项了。我知道EF 7仍处于测试阶段,并且SQLite提供程序不完整,但是有解决方法吗?我不打算在Linux中使用迁移。

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.

更新

I当时以为我可以创建一个扩展方法来确保编译成功,但无法识别此类。

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


推荐答案

Microsoft发现了一个区分大小写的程序包名称的错误。

Microsoft found a bug concerning case-sensitive package names.

将依赖项从 EntityFramework.SQLite.Design 更改为 EntityFramework.Sqlite.Design 解决了该问题。

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

这篇关于ASP.NET 5,EF 7和SQLite-编译器错误CS1061的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 04:13