dfmetro
dfmetro

Reputation: 4582

Cannot add EntityFrameworkCore Tools to class library in Visual Studio 2017

I created a new Class Library (.Net Core) and wanted to add the package Microsoft.EntityFrameworkCore.Tools.DotNet 1.0.0. However I refuses and I get the following error

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

I also tried it in a Class Library (.Net Framework)

Same error message when using the Package Manager Console command

Install-Package Microsoft.EntityFrameworkCore.Tools.DotNet

Upvotes: 4

Views: 2744

Answers (1)

divega
divega

Reputation: 6476

CLI tool packages cannot be added as standard package references. You need something like this in your csproj file:

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

This is a bug/limitation in NuGet. See https://github.com/NuGet/Home/issues/4190 for more details.

Upvotes: 7

Related Questions