实体框架安装麻烦

时间:2018-05-14 13:52:04

标签: c# .net entity-framework

添加

后运行$ dotnet restore
<ItemGroup>
<PackageReference Include="EntityFramework" Version="6.2.0"/>
</ItemGroup>`  

DBCreation.csproj (无论是manualy还是NuGet)没有任何事情发生,只是完成了

Restoring packages for /home/denis/Documents/projects/dotNet/DBCreation/DBCreation.csproj...

Entity中的using System.Data.Entity;仍标记为

"The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?) [DBCreation]"

尝试运行时(只有Hello world!使用此功能):

$dotnet run 
The build failed. Please fix the build errors and run again.

但是

$ dotnet build
Microsoft (R) Build Engine version 15.6.84.34536 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

Restoring packages for 
/home/denis/Documents/projects/dotNet/DBCreation/DBCreation.csproj...

完成restore,但没有显示错误。

当.csproj列表中没有EntityFramework时,恢复完成如

Restoring packages for /home/denis/Documents/projects/dotNet/DBCreation/DBCreation.csproj...
Restore completed in 751.55 ms for /home/denis/Documents/projects/dotNet/DBCreation/DBCreation.csproj.

并且工作正确。

我在Debian 9上使用Visual Studio Code。

$ dotnet --info
.NET Command Line Tools (2.1.105)

Product Information:
Version:            2.1.105
Commit SHA-1 hash:  141cc8d976

Runtime Environment:
OS Name:     debian
OS Version:  9
OS Platform: Linux
RID:         debian.9-x64
Base Path:   /usr/share/dotnet/sdk/2.1.105/

Microsoft .NET Core Shared Framework Host

Version  : 2.0.7
Build    : 2d61d0b043915bc948ebf98836fefe9ba942be11

如何将Entity Framework添加到项目中,还原有什么问题以及我的错误在哪里?

0 个答案:

没有答案