【问题标题】:Getting 'MissingMethodException' when trying to use 'dnx . ef migration add' in EF7 beta6尝试使用 'dnx 时出现'MissingMethodException'。 EF7 beta6 中的 ef 迁移添加
【发布时间】:2015-11-05 00:56:50
【问题描述】:

我正在尝试在 Visual Studio 2015 RTM 中使用 ASP.NET 5 beta5 和 Entity Framework 7 beta6。问题是即使完全遵循这样的指南,我也无法让它们一起运行: http://ef.readthedocs.org/en/latest/getting-started/aspnet5.html

在这个例子中,当我到达我需要运行这个命令的部分时:

dnx . ef migration add MyFirstMigration

我总是收到这个错误:

Using context 'BloggingContext'.
System.MissingMethodException: Method not found: 'Boolean Microsoft.Framework.DependencyInjection.ServiceCollectionExtensions.TryAdd(Microsoft.Framework.DependencyInjection.IServiceCollection, Microsoft.Framework.DependencyInjection.ServiceDescriptor)'.

我尝试并重试了所有步骤,并搜索了我在项目中可能错过的任何内容。

【问题讨论】:

  • 我以某种方式发现问题出在“project.json”中引用的不同 beta 版本中。其中一些在 beta5 和一些 beta6 中。但是我不明白为什么当我创建一个新的 ASP.NET 项目时,默认引用最终是从两个不同的 beta 版本中添加的。正在努力。

标签: c# asp.net entity-framework entity-framework-core


【解决方案1】:

此问题可能是因为您使用的 Dot Net 虚拟机版本不正确(或只是有问题)。尝试运行dnvm list 以查看您安装了哪些版本以及设置为活动的版本,然后您可能需要运行dnvm use ... 来切换版本。

例如,我为我的许多 .csproj 应用运行 dnvm use 1.0.0-rc1-update1

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-11-11
    • 1970-01-01
    • 1970-01-01
    • 2016-01-16
    • 1970-01-01
    • 2017-05-30
    • 1970-01-01
    相关资源
    最近更新 更多