efcore: Can't install EFCore.Tools.DotNet package via Package Mgr to .NET Core or .NET Standard class library in VS2017 (windows)

Describe what is not working as expected. In latest VS2017 (Mar 9 update ), I cannot add the DotNet tools package to a .NET Core project or a .NET Stnadard class library project either via Package Manager or directly in csproj.

The same behavior occurs in the RTW version from Mar 7.

Is this by design? Are you forcing us to install the PowerShell tools if we are using VS2017? (I hope not 😉 )

Package Manager throws this error: Package ‘Microsoft.EntityFrameworkCore.Tools.DotNet 1.0.0’ has a package type ‘DotnetCliTool’ that is not supported by project 'ClassLibrary1.

Steps to reproduce

New solution. Add new project, .NET Core, ClassLibrary (.nET Core). Here is the default csproj:

<Project Sdk="Microsoft.NET.Sdk">   
  <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
  </PropertyGroup>
</Project>

Open Package Manager via “Manage packages” context menu. Filter on EntityFrameworkCore.Tools Select Tools.DotNet package and install. Error pane displays:“Package ‘Microsoft.EntityFrameworkCore.Tools.DotNet 1.0.0’ has a package type ‘DotnetCliTool’ that is not supported by project 'ClassLibrary1.” and the csproj is not modified.

Open csproj. Add in:

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

Save & rebuild, this is fine.

I have the same results (failed via Package Manager, ok via csproj) with a .NET Standard Library project.

Further technical details

EF Core version:

>dotnet --info
.NET Command Line Tools (1.0.1)

Product Information:
 Version:            1.0.1
 Commit SHA-1 hash:  005db40cd1

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\1.0.1

Database Provider: (e.g. Microsoft.EntityFrameworkCore.SqlServer) Operating system: Windows 10 IDE: Microsoft Visual Studio Enterprise 2017, Version 15.0.26228.4 D15RTWSVC Nuget Package Manager 4.0.0

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 11
  • Comments: 29 (13 by maintainers)

Most upvoted comments

well, boo. (shakes fist (in most friendly manner of course) at @rrelyea for punting). I think that if someone with my level of experience spent 1/2 hour scratching her head over this, it’s going to be hard for others. But okay. Will be sure to mention all of these points out as I’m revising my efcore course)

You can add it manually in your .csproj file until it is fixed.

  1. Open your .csproj file in a text editor of your choice.
  2. Insert the line <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.1" /> within an open and close ItemGroup tag.
  3. Save the file and restore packages.

@hkumipig - You are hitting https://github.com/aspnet/EntityFrameworkCore/issues/10957 Please run dotnet restore on CLI manually.

I´ll try it later myself to confirm, but it should also work.

Yes, it works for 1.0.1 as well.

This is still broken with .Net Standard 2.0

Well, the command succeeds, but it doesn’t do it right:

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