Cannot add EntityFrameworkCore Tools to class library in Visual Studio 2017

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

Question

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

1
4
3/7/2017 5:16:59 PM

Popular Answer

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.

7
3/10/2017 5:05:47 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow