如何将Cake.CoreCLR NuGet软件包安装到我的工具文件夹中?

问题描述

this answer的第1步说Install Cake.CoreCLR NuGet package to your tools folder。我该怎么办?

我尝试过的事情:

> dotnet add package Cake.CoreCLR --version 0.38.4
Could not find any project in `current folder`.
Usage: dotnet add <PROJECT> package [options] <PACKAGE_NAME>

> dotnet tool install Cake.CoreCLR --version 0.38.4 -g
error NU1212: Invalid project-package combination for Cake.CoreCLR 0.38.4. DotnetToolReference project style can only contain references of the DotnetTool type
The tool package Could not be restored.
Tool 'cake.coreclr' Failed to install. This failure may have been caused by:

* You are attempting to install a preview release and did not use the --version option to specify the version.
* A package by this name was found,but it was not a .NET Core tool.
* The required NuGet Feed cannot be accessed,perhaps because of an Internet connection problem.
* You mistyped the name of the tool.

For more reasons,including package naming enforcement,visit https://aka.ms/failure-installing-tool

解决方法

对于在.NET Core上运行Cake的情况,我们建议使用作为本地工具清单安装的.NET Core工具:

dotnet new tool-manifest
dotnet tool install Cake.Tool --version 0.38.4

之后,您需要还原该工具:

dotnet tool restore

并且可以使用dotnet运行它:

dotnet cake

有关详细信息,请参见Bootstrapping for .NET Core Tool

,

如果您使用的是 Cake extension for Visual Studio Code v1.0+,则可以通过运行以下命令安装 Cake.CoreCLR

  • CTRL + Shift + P(或 Mac OSX 上的 Command + Shift + P)
  • 选择Cake: Install debug dependencies
  • 然后选择Cake runner for .NET Core

这会将 Cake.CoreCLR 安装到您的 Cake tools 文件夹中。

Cake: Install debug dependencies

Cake runner for .NET Core