如何在EF7中修复此错误?

时间:2016-02-10 14:39:38

标签: c# windows entity-framework visual-studio entity-framework-core

我正在尝试使用EF7

This is the example我现在正试图跑。

我收到以下错误:

enter image description here

这是我的packages.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="EntityFramework.Commands" version="7.0.0-rc1-final" targetFramework="net452" />
  <package id="EntityFramework.Core" version="7.0.0-rc1-final" targetFramework="net452" />
  <package id="EntityFramework.Relational" version="7.0.0-rc1-final" targetFramework="net452" />
  <package id="EntityFramework.Relational.Design" version="7.0.0-rc1-final" targetFramework="net452" />
  <package id="EntityFramework.SqlServer" version="7.0.0-beta8" targetFramework="net452" />
  <package id="EntityFramework.SqlServer.Design" version="7.0.0-beta8" targetFramework="net452" />
  <package id="Ix-Async" version="1.2.5" targetFramework="net452" />
  <package id="Microsoft.Extensions.Caching.Abstractions" version="1.0.0-rc1-final" targetFramework="net452" />
  <package id="Microsoft.Extensions.Caching.Memory" version="1.0.0-rc1-final" targetFramework="net452" />
  <package id="Microsoft.Extensions.Configuration" version="1.0.0-rc1-final" targetFramework="net452" />
  <package id="Microsoft.Extensions.Configuration.Abstractions" version="1.0.0-rc1-final" targetFramework="net452" />
  <package id="Microsoft.Extensions.Configuration.Binder" version="1.0.0-rc1-final" targetFramework="net452" />
  <package id="Microsoft.Extensions.DependencyInjection" version="1.0.0-rc1-final" targetFramework="net452" />
  <package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="1.0.0-rc1-final" targetFramework="net452" />
  <package id="Microsoft.Extensions.Logging" version="1.0.0-rc1-final" targetFramework="net452" />
  <package id="Microsoft.Extensions.Logging.Abstractions" version="1.0.0-rc1-final" targetFramework="net452" />
  <package id="Microsoft.Extensions.OptionsModel" version="1.0.0-rc1-final" targetFramework="net452" />
  <package id="Microsoft.Extensions.Primitives" version="1.0.0-rc1-final" targetFramework="net452" />
  <package id="Remotion.Linq" version="2.0.1" targetFramework="net452" />
  <package id="System.Collections.Immutable" version="1.1.36" targetFramework="net452" />
  <package id="System.Diagnostics.DiagnosticSource" version="4.0.0-beta-23516" targetFramework="net452" />
  <package id="System.Diagnostics.Tracing" version="4.0.0" targetFramework="net452" />
  <package id="System.Runtime" version="4.0.0" targetFramework="net452" />
  <package id="System.Threading" version="4.0.0" targetFramework="net452" />
</packages>

正如您所见,此处已声明EF.Core

我也有警告

The 'packages' element is not declared.

那么问题是什么?

注意:我使用的是Windows 10 ProVS Enterprise 2015

1 个答案:

答案 0 :(得分:1)

您必须删除EF.SqlServer并安装EF.MicrosoftSqlServer软件包,因为您不能混用beta8和rc1组件