Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VS 2017: PackageType=DotnetCliTool fails to install #4190

Closed
natemcmaster opened this issue Jan 4, 2017 · 52 comments
Closed

VS 2017: PackageType=DotnetCliTool fails to install #4190

natemcmaster opened this issue Jan 4, 2017 · 52 comments
Labels
Priority:2 Issues for the current backlog. Product:VS.Client Type:Feature
Milestone

Comments

@natemcmaster
Copy link

natemcmaster commented Jan 4, 2017

Details

VS 2017: 15.0.26014
NuGet GUI
Worked in NuGet: 3.5.0.1996 with VS 2015 u3

Repro

  1. File -> New -> Project -> .NET Core -> Console App
  2. Project -> Manage NuGet packages...
  3. Attempt to install a "CLI tool" package, e.g. https://www.nuget.org/packages/Microsoft.DotNet.Watcher.Tools/1.1.0-preview4-final

Fails with error:

Package 'Microsoft.DotNet.Watcher.Tools 1.1.0-preview4-final' has a package type 'DotnetCliTool' that is not supported by project 'ConsoleApp1'.

image

More details

The package's NuSpec:

    <packageTypes>
      <packageType name="DotnetCliTool" />
    </packageTypes>

Output window:

Restoring packages for C:\Users\nmcmaster\documents\visual studio 2017\Projects\ConsoleApp1\ConsoleApp1\ConsoleApp1.csproj...
Detected package downgrade: Microsoft.NETCore.App from 1.1.0 to 1.0.1 
 ConsoleApp1 (>= 1.0.0) -> Microsoft.DotNet.Watcher.Tools (>= 1.1.0-preview4-final) -> Microsoft.NETCore.App (>= 1.1.0) 
 ConsoleApp1 (>= 1.0.0) -> Microsoft.NETCore.App (>= 1.0.1)
Package 'Microsoft.DotNet.Watcher.Tools 1.1.0-preview4-final' has a package type 'DotnetCliTool' that is not supported by project 'ConsoleApp1'.
========== Finished ==========
Time Elapsed: 00:00:01.9317626

The project:

<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp1.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="**\*.cs" />
    <EmbeddedResource Include="**\*.resx" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.NETCore.App" Version="1.0.1" />
  </ItemGroup>
</Project>

cc @joelverhagen

@muratg
Copy link

muratg commented Jan 4, 2017

@rrelyea, this used to work on VS2015 so looks like a regression that would impact all of the tool projects that use this flag.

@Eilon, could you add this bug to your tracking list?

@rrelyea rrelyea added this to the 4.0 RC3 milestone Jan 4, 2017
@rrelyea rrelyea added Functionality:Restore Type:Bug Priority:2 Issues for the current backlog. labels Jan 4, 2017
@natemcmaster
Copy link
Author

natemcmaster commented Jan 4, 2017

@rrelyea
Copy link
Contributor

rrelyea commented Jan 4, 2017

@natemcmaster - We punted the work to support tools installs via the UI with the idea that tools will be installed by default with new projects ... and that people can edit the csproj if an addition is needed.
Make sense?

@natemcmaster
Copy link
Author

Makes sense. Would still love to see this make it in to RTM.

But if this gets bumped, can we at least change the error? It currently says that the project doesn't support CLI tools, which may mislead some to believe .NET Core CLI tools don't work anymore.

@rrelyea rrelyea modified the milestones: Future-1, 4.0 RC3 Jan 5, 2017
@natemcmaster
Copy link
Author

cc @DamianEdwards

@balachir
Copy link

balachir commented Jan 6, 2017

+1 on a better error message when doing this from the Manage NuGet packages UI

Rob suggested it might be possible to get this working from the Install-Package power shell command for RC3 / RTM. @rrelyea ?

@bricelam
Copy link

dotnet add package doesn't support it correctly either.

@isaacrlevin
Copy link

This issue still exists with Dot Net Standard 2.0. Is there any update on this issue? I want to be able to use EF Core in a CL targeting standard 2.0 and this stops this from being possible

@geirsagberg
Copy link

As a workaround, you can edit the .csproj file and add the tool manually, e.g.:

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.Dotnet" Version="2.0.0-preview2-final" />
  </ItemGroup>

@j4zzlee
Copy link

j4zzlee commented Jul 10, 2017

@geirsagberg,
Still does not work. When use "dotnet restore", it still says: "... has a package type 'DotnetCliTool' that is not supported ..."

@AdrienTorris
Copy link

Same error than @st2forget . I tried to add the package manually in the csproj but the error is still the same.

@AdrienTorris
Copy link

It works now. I did nothing, just wait ...

@dtwilliams10
Copy link

Still not working for me, same error as @st2forget

@Eilon
Copy link

Eilon commented Sep 12, 2017

You still install them in the project (into the same CSPROJ file), but as tools references, not package references. They are represented as different XML elements inside the CSPROJ.

@Bunabun
Copy link

Bunabun commented Jan 4, 2018

Any news on this? Are we doomed to forever manually edit the .csproj file?

@Eilon
Copy link

Eilon commented Jan 4, 2018

I think with the upcoming Global Tools feature the priority of this might be a bit lower.

I think @KathleenDollard and @richlander can share more thoughts on this.

@KathleenDollard
Copy link

Tools aren't really packages, they have a different purpose, so add package seems the wrong gesture.

We're working on a better tooling story overall, and EF is definitely in that mix. More to come soon.

@raffaeler
Copy link

@KathleenDollard are you saying that there is no solution for the current release of the product?

@cgountanis
Copy link

cgountanis commented Feb 28, 2018

Still having this issue with the latest SDK.

Error when adding the tools via NUGET as well. Right now we have to add that line manually to do migrations etc...

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

How are people using EF in CORE without this working?

@MisinformedDNA
Copy link

Because we are doing it manually as well. It's annoying, but it shouldn't block you.

@bricelam
Copy link

bricelam commented Mar 2, 2018

Here are the docs on how to install the EF Core tools. (manually)

@vmukunda
Copy link

vmukunda commented Apr 3, 2018

As specified by @geirsagberg adding the following dependancy directly to the .csproj file worked for me.

<ItemGroup>
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.Dotnet" Version="2.0.0-preview2-final" />
 </ItemGroup>

@rkmr039
Copy link

rkmr039 commented May 9, 2018

start Developer Command Prompt for VS 2017 and change directory to current project
then run this command
dotnet add package Microsoft.EntityFrameworkCore.Tools.DotNet

vs_cmd
and then rebuild the project

package_added

@SuperJMN
Copy link

I'm experiencing the same issue. Someone please fix it.

@rrelyea
Copy link
Contributor

rrelyea commented May 14, 2019

We're not planning on adding CLI support for dotnetclitoolreferences anymore.
dotnet global tools, etc... are the direction.

@rrelyea rrelyea closed this as completed May 14, 2019
@MisinformedDNA
Copy link

@rrelyea What does that mean? Are you going to stop using DotNetCliToolReferences altogether? Or that they won't work when installed via the CLI. Cause this bug was occurring when installed via VS.

@CuneytBozyel
Copy link

I made it by running command in cmd:

dotnet add package Microsoft.EntityFrameworkCore.Tools.DotNet

Best regards!

it works for me

@cgountanis
Copy link

Little help for those trying Core 3 Preview

https://wildermuth.com/2019/08/19/My-First-Look-at-ASP-NET-Core-3-0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:2 Issues for the current backlog. Product:VS.Client Type:Feature
Projects
None yet
Development

No branches or pull requests