问题
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