.net core 安装&;在azure devops发行版上运行自定义dotnet工具

.net core 安装&;在azure devops发行版上运行自定义dotnet工具,.net-core,azure-devops,.net Core,Azure Devops,我正试图构建一个发布管道,由发布的dotnet核心工具的新版本触发。触发器工作正常,但我无法在任务中安装和运行该工具 当前: 运行401将导致: dotnet tool install -g --add-source=https://pkgs.dev.azure.com/<org-name>/_packaging/Tools/nuget/v3/index.json MyApp 或 [命令]“C:\Program Files\dotnet\dotnet.exe”工具安装-g--添加源

我正试图构建一个发布管道,由发布的dotnet核心工具的新版本触发。触发器工作正常,但我无法在任务中安装和运行该工具

当前:

运行401将导致:

dotnet tool install -g --add-source=https://pkgs.dev.azure.com/<org-name>/_packaging/Tools/nuget/v3/index.json MyApp

[命令]“C:\Program Files\dotnet\dotnet.exe”工具安装-g--添加源代码=https://pkgs.dev.azure.com//_packaging/Tools/nuget/v3/index.json MyApp“
我尝试了不同的参数,我总是会看到相同的错误消息:

Could not execute because the specified command or file was not found.
Possible reasons for this include:
   * You misspelled a built-in dotnet command.
   * You intended to execute a .NET Core program, but dotnet-dotnet tool install -g --add-source=https://pkgs.dev.azure.com/<org-name>/_packaging/Tools/nuget/v3/index.json MyApp does not exist.
   * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
无法执行,因为找不到指定的命令或文件。
可能的原因包括:
*您拼错了一个内置的dotnet命令。
*您打算执行.NET核心程序,但dotnet dotnet tool install-g--addsource=https://pkgs.dev.azure.com//_packaging/Tools/nuget/v3/index.json MyApp不存在。
*您打算运行全局工具,但在路径上找不到带有此名称的dotnet前缀可执行文件。

您的自定义dotnet命令被引用,并且
dotnet
被重复:
dotnet.exe”“dotnet工具安装…”
因此该命令被误解

您可以使用并直接设置
dotnet
命令:

dotnet tool install -g --add-source=https://pkgs.dev.azure.com/<org-name>/_packaging/Tools/nuget/v3/index.json MyApp
dotnet工具安装-g--添加源代码=https://pkgs.dev.azure.com//_packaging/Tools/nuget/v3/index.json MyApp

在尝试使用.Net核心任务访问nuget提要之前,您需要添加nuget authenticate任务

由于引用了dotnet命令,您需要将tool设置为命令并更新为参数。如果需要,NuGet Auth任务可以提供NuGet凭据


非常好,谢谢!我现在遇到了一个401未经授权的错误,这对于专用devops提要来说更为合理。我将相应地更新我的问题。我在Azure devops中的自定义
dotnet
命令任务中遇到了类似的问题,在该任务中,提供
pack something
会产生一个命令
dotnet.exe”打包一些明显错误的东西“
。Powershell任务确实带来了dotnet内容。您应该为此开始一个新问题并接受此答案,因为这是一个全新的\n不相关的问题
[command]"C:\Program Files\dotnet\dotnet.exe" "tool install -g --add-source=https://pkgs.dev.azure.com/<org-name>/_packaging/Tools/nuget/v3/index.json MyApp"
Could not execute because the specified command or file was not found.
Possible reasons for this include:
   * You misspelled a built-in dotnet command.
   * You intended to execute a .NET Core program, but dotnet-dotnet tool install -g --add-source=https://pkgs.dev.azure.com/<org-name>/_packaging/Tools/nuget/v3/index.json MyApp does not exist.
   * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
dotnet tool install -g --add-source=https://pkgs.dev.azure.com/<org-name>/_packaging/Tools/nuget/v3/index.json MyApp