.net-core - 无法将 EntityFrameworkCore 工具添加到 Visual Studio 2017 中的类库

标签 .net-core entity-framework-core visual-studio-2017

我创建了一个新的类库 (.Net Core) 并想添加包 Microsoft.EntityFrameworkCore.Tools.DotNet 1.0.0 .但是我拒绝并收到以下错误

Severity Code Description Project File Line Suppression State Error Package 'Microsoft.EntityFrameworkCore.Tools.DotNet 1.0.0' has a package type 'DotnetCliTool' that is not supported by project 'MyVS2017Project'. 0



我也在类库(.Net Framework)中尝试过

使用包管理器控制台命令时出现相同的错误消息

Install-Package Microsoft.EntityFrameworkCore.Tools.DotNet

最佳答案

CLI 工具包不能作为标准包引用添加。您的 csproj 文件中需要这样的内容:

<ItemGroup>
<DotNetCliToolReference 
    Include="Microsoft.EntityFrameworkCore.Tools.DotNet" 
    Version="1.0.0" />
</ItemGroup>

这是 NuGet 中的错误/限制。见 https://github.com/NuGet/Home/issues/4190更多细节。

关于.net-core - 无法将 EntityFrameworkCore 工具添加到 Visual Studio 2017 中的类库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42654217/

相关文章:

c# - 如何在 .NET Core 3.0 中为 WPF 应用程序引用 System.Windows.Forms?

c# - 添加迁移失败,因为未安装 EntityFrameworkCore.Tools

c# - 在 EF Core 中过滤 "include"实体

c++ - vs2017 输出错误但 mingw 有效

c# - 将 ILogger 或 ILoggerFactory 传递给 AspNet Core 中的构造函数?

nuget - 在 dotnet 包中包含自定义配置文件

c# - 为什么 add-migration 命令没有创建迁移?不识别包裹

C# 关系型数据库

.net - 使用 MSBuild 构建混合 DotNet Core/.NET Framework

visual-studio - Visual Studio 2019 Visual Studio 2017 中的 C# 代码颜色