首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何从工件提要运行nuget包(工具)

如何从工件提要运行nuget包(工具)
EN

Stack Overflow用户
提问于 2022-11-08 13:40:42
回答 1查看 72关注 0票数 0

我是虔诚的乞丐。我有一项任务要创建2条管道。一个用于构建项目并将其发布到工件提要。另一条管道就是运行这个工具。第一个我已经创建了(创建nuget作为一个工具,并放置在我的提要)。现在,我如何创建执行dotnet run的管道,而不是从我的提要创建管道呢?

我只需要一个大方向的指导。

我试着做这样的事:

代码语言:javascript
复制
 pool:
  vmImage: windows-latest

   jobs:
- job: RunTool
  displayName: Run Tool
  steps:
      - task: DotNetCoreCLI@2
        inputs:
          command: 'custom'
          custom: 'tool'
          arguments: 'install -g --add-source=https://pkgs.dev.azure.com/EPMC-STC/ab5c31ad-1d77-4369-80f4-ff2f14a12667/_packaging/MilanDjukicFeed/nuget/v3/index.json MigrationApp --version 8.0.18'

我得到了:

代码语言:javascript
复制
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only).
Learn about HTTPS: https://aka.ms/dotnet-https
----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
C:\Users\VssAdministrator\AppData\Local\Temp\d49e97f8-e901-42d7-8c3e-d1eca71c6055\restore.csproj : error NU1301: Unable to load the service index for source https://pkgs.dev.azure.com/EPMC-STC/ab5c31ad-1d77-4369-80f4-ff2f14a12667/_packaging/MilanDjukicFeed/nuget/v3/index.json.
The tool package could not be restored.
Tool 'migrationapp' 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 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
##[error]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1
Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
##[error]Dotnet command failed with non-zero exit code on the following projects : 
Finishing: DotNetCoreCLI

关于工件的我有MigrationApp nuget包。我可以下载并在本地运行.

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-11-09 11:58:08

因为您正在创建Nuget作为工具,并且需要在管道中使用它,所以可以使用dotnet工具安装命令来安装Nuget工具并定义提要源。

例如:添加命令行任务/ Bash任务/ PowerShell

代码语言:javascript
复制
dotnet tool install -g --add-source=https://pkgs.dev.azure.com/<org-name>/<projectname>/_packaging/<feedname>/nuget/v3/index.json toolname

然后,您可以在下一个任务中使用nuget工具。

另一方面,如果需要下载Nuget包,可以使用任务:下载包任务从提要下载nuget包并执行下一步操作。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74361706

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档