gpt4 book ai didi

.net-core - 如何在 Azure Pipelines (VSTS) 构建任务中安装和使用 dotnet 核心工具 (CLI)?

转载 作者:行者123 更新时间:2023-12-03 12:27:53 25 4
gpt4 key购买 nike

我想创建自定义构建任务,这将调用 dotnet 核心 CLI 工具。我用过 VSTS DevOps Task SDK/node获取或安装该工具:

import tl = require('vsts-task-lib/task');

async function getLibmanTool() {
let libmanExePath = tl.which('libman');
if (!libmanExePath){
console.log("Libman CLI not found. Installing..")
var dotnet = tl.tool(tl.which('dotnet', true));
await dotnet.arg(['tool', 'install', '-g', 'Microsoft.Web.LibraryManager.Cli']).exec();
}
libmanExePath = tl.which('libman', true); //this line throws, see output
return tl.tool(libmanExePath);
}

但是,当我在 Build Pipeline 中使用该工具时:
enter image description here

我收到以下错误:
Libman CLI not found. Installing..
[command]C:\hostedtoolcache\windows\dncs\2.1.105\x64\dotnet.exe tool install -g Microsoft.Web.LibraryManager.Cli
Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed.
You can invoke the tool using the following command: libman
Tool 'microsoft.web.librarymanager.cli' (version '1.0.163') was successfully installed.
##[error]Unable to locate executable file: 'libman'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.

好像我在pipleline中安装.NET Core SDK时,找不到dotnet工具

题:

如何安装然后安全地使用 dotnet core 工具?有什么解决方法吗?

Since you just installed the .NET Core SDK, you will need to reopen the Command Prompt window before running the tool you installed

最佳答案

据我所知,没有任何解决方法可以避免重新打开 CMD。

要使其工作,您可以在安装包时指定安装路径,然后调用 liman.exe 的完整路径。或者,如果您想使用“-g”全局安装它,那么 liman.exe 的路径应该是“%USERPROFILE%\.dotnet\tools\liman.exe”。

关于.net-core - 如何在 Azure Pipelines (VSTS) 构建任务中安装和使用 dotnet 核心工具 (CLI)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52586698/

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