gpt4 book ai didi

.net-core - 在 azure devops 版本上安装和运行自定义 dotnet 工具

转载 作者:行者123 更新时间:2023-12-04 01:00:13 24 4
gpt4 key购买 nike

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

当前:

运行 Command Line Task结果是 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\sdk\3.0.100\NuGet.targets(123,5): error : Unable to load the service index for source https://pkgs.dev.azure.com/<org-name>/_packaging/Tools/nuget/v3/index.json. [C:\Users\VssAdministrator\AppData\Local\Temp\h0g1c35v.eny\restore.csproj]
C:\Program Files\dotnet\sdk\3.0.100\NuGet.targets(123,5): error : Response status code does not indicate success: 401 (Unauthorized). [C:\Users\VssAdministrator\AppData\Local\Temp\h0g1c35v.eny\restore.csproj]
The tool package could not be restored.
Tool 'myapp' 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

这让我相信我在这里遗漏了一些东西,使它比需要的更复杂,或者以错误的方式思考这个问题。提要中的工具可以在本地安装,所以我相信这是我的发布方法。

我目前正在调查 Personal Access Tokens (PAT)

以前 :

如果我使用 .Net 核心任务 custom选项:

List of .Net Core commands

日志显示传递给 dotnet.exe 的错误命令:
[command]"C:\Program Files\dotnet\dotnet.exe" "dotnet tool install -g --add-source=https://pkgs.dev.azure.com/<org-name>/_packaging/Tools/nuget/v3/index.json MyApp"

或者
[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 命令被引用并且 dotnet重复:dotnet.exe" "dotnet tool install ..."所以命令被误解了。

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

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

关于.net-core - 在 azure devops 版本上安装和运行自定义 dotnet 工具,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58905151/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com