【问题标题】:Error when try to use EntityFramework 7 + SQLite on OSX尝试在 OSX 上使用 EntityFramework 7 + SQLite 时出错
【发布时间】:2015-10-20 15:37:41
【问题描述】:

我正在尝试在 Mac OSX 环境中使用 .Net Core 的示例应用程序上使用 EntityFramework 7 + SQLite。我已经安装了 Mono 4.0.2 和 .Net 版本管理器,这是我的“dnvm list”命令结果:

   1.0.0-beta7-12274    coreclr x64  darwin
   1.0.0-beta6          mono         linux/darwin    default
   1.0.0-beta7-12274    mono         linux/darwin
*  1.0.0-beta7-12275    mono         linux/darwin

当尝试执行一些 EntityFramework.Command 时,会出现以下问题:

System.TypeLoadException: Could not load type 'Microsoft.Framework.Runtime.ILibraryInformation' from assembly 'Microsoft.Framework.Runtime.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

完整的堆栈是:

System.TypeLoadException:无法从程序集“Microsoft.Framework.Runtime.Abstractions,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null”加载类型“Microsoft.Framework.Runtime.ILibraryInformation”。 在 Microsoft.Data.Entity.Commands.Program.Execute (System.String startupProject, System.Func1 invoke) [0x00000] in <filename unknown>:0 at Microsoft.Data.Entity.Commands.Program.AddMigration (System.String name, System.String context, System.String startupProject) [0x00000] in <filename unknown>:0 at Microsoft.Data.Entity.Commands.Program+<>c__DisplayClass10_1.<Main>b__7 () [0x00000] in <filename unknown>:0 at Microsoft.Framework.Runtime.Common.CommandLine.CommandLineApplication.Execute (System.String[] args) [0x00000] in <filename unknown>:0 at Microsoft.Data.Entity.Commands.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 at Microsoft.Framework.Runtime.Common.EntryPointExecutor.Execute (System.Reflection.Assembly assembly, System.String[] args, IServiceProvider serviceProvider) [0x00000] in <filename unknown>:0 at Microsoft.Framework.ApplicationHost.Program.ExecuteMain (Microsoft.Framework.Runtime.DefaultHost host, System.String applicationName, System.String[] args) [0x00000] in <filename unknown>:0 at Microsoft.Framework.ApplicationHost.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 at Microsoft.Framework.Runtime.Common.EntryPointExecutor.Execute (System.Reflection.Assembly assembly, System.String[] args, IServiceProvider serviceProvider) [0x00000] in <filename unknown>:0 at dnx.host.Bootstrapper.RunAsync (System.Collections.Generic.List1 args, IRuntimeEnvironment env, System.Runtime.Versioning.FrameworkName targetFramework) [0x00000] in :0

【问题讨论】:

    标签: macos sqlite asp.net-core entity-framework-core dnx


    【解决方案1】:

    ILibraryInformation 最近已重命名,您使用的 DNX beta7 可能包含此更改:确保在您的 project.json 文件中也引用最近的 beta7 包。

    您可以使用通配符来引用最新版本:

    "dependencies": {
        "EntityFramework.Sqlite": "7.0.0-*"
    }
    

    【讨论】:

    • 谢谢@Pinpoint,我在这个问题的另一个答案中提供了详细信息,你能检查一下吗??
    【解决方案2】:

    由于项目重命名,夜间构建目前已中断。要仅使用 beta6,您可能需要尝试以下步骤:

    • 删除~/.dnx/packages。其中一些可能包含重命名后和重命名前的混合引用。
    • 确保您没有使用每晚的 nuget 提要 (myget.org)
    • dnvm use 1.0.0-beta6
    • 确保在 project.json 中使用 "EntityFramework.Commands": "7.0.0-beta6""EntityFramework.Sqlite": "7.0.0-beta6"
    • 按照 OS X 入门指南中的 Workarounds 操作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-02-22
      • 2018-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-27
      • 1970-01-01
      相关资源
      最近更新 更多