【发布时间】:2017-08-31 08:28:19
【问题描述】:
我已经创建了一个针对 .NETPortable, v4.0 的可移植类库
在下面的课程中
public class AddressConfiguration : EntityTypeConfiguration<Address>
{
public AddressConfiguration()
{
ToTable("Addresses");
HasKey(c => c.Id);
}
}
在行HasKey(c => c.Id);
关于视觉工作室的投诉
The type 'Expression<>' is defined in an assembly that is not referenced.
You must add a reference to assembly 'System.Core, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'.
我在这里错过了什么?
App.config 是
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
而packages.config 是
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.1.3" targetFramework="portable40-net45+sl5" />
</packages>
【问题讨论】:
-
错误是什么?
-
@Nikolaus 你是什么意思?我已将其包含在问题中
-
你用的是哪个版本的VS?
-
@Nikolaus 2015.
-
你能把你的 project.csproj 添加到列出所有引用的地方吗?
标签: c# entity-framework visual-studio-2015 portable-class-library ef-fluent-api