Azure devops 在构建时将包添加到dotnet核心项目Azure管道
我正在设置Azure构建管道,以便在发布NuGet包时自动构建。在这个构建定义中,我想安装这个包的最新版本 根据答案,我需要首先恢复包,以根据Dev-Ops提要进行身份验证 我已设置build.yml文件以包含以下任务:Azure devops 在构建时将包添加到dotnet核心项目Azure管道,azure-devops,azure-artifacts,dotnetcorecli,Azure Devops,Azure Artifacts,Dotnetcorecli,我正在设置Azure构建管道,以便在发布NuGet包时自动构建。在这个构建定义中,我想安装这个包的最新版本 根据答案,我需要首先恢复包,以根据Dev-Ops提要进行身份验证 我已设置build.yml文件以包含以下任务: - task: DotNetCoreCLI@2 displayName: 'Restore Packages' inputs: command: restore projects: web/*.csproj vstsFeed: organizat
- task: DotNetCoreCLI@2
displayName: 'Restore Packages'
inputs:
command: restore
projects: web/*.csproj
vstsFeed: organizational-packages
- task: DotNetCoreCLI@2
displayName: Install Custom Internal Package Package
inputs:
command: 'custom'
custom: 'add'
arguments: 'package Custom.Internal.Package --prerelease'
projects: 'Web/*.csproj'
feedsToUse: 'select'
feedRestore: 'organizational-packages'
NuGet提要托管在Azure开发操作中,具有组织范围
当我运行构建时-Azure软件包订阅源不包括在软件包搜索中:
info : Adding PackageReference for package 'Custom.Internal.Package' into project
'/home/vsts/work/1/s/Project.Web/Web.csproj'.
info : GET https://api.nuget.org/v3/registration5-gz-semver2/custom.internal.package/index.json
info : NotFound https://api.nuget.org/v3/registration5-gz-semver2/cbh.surescripts.business/index.json 202ms
error: There are no versions available for the package 'Custom.Internal.Package'.
- task: DotNetCoreCLI@2
displayName: 'dotnet custom'
inputs:
command: custom
projects: 'Web/*.csproj'
custom: add
arguments: 'package Custom.Internal.Package --prerelease -v 1.0.0'
该软件包位于https://myorg.pkgs.visualstudio.com/_packaging/organizational-packages/nuget/v3/index.json
我甚至试着只用命令行任务来完成这一点:
- task: NuGetAuthenticate@0
displayName: Authenticate NuGet Feed
- task: CmdLine@2
displayName: Add Organizational Package Source
inputs:
script: 'dotnet nuget add source https://myorg.pkgs.visualstudio.com/_packaging/organizational-packages/nuget/v3/index.json -n credible'
- task: CmdLine@2
displayName: Install Custom Internal Package
inputs:
script: 'dotnet add package Custom.Internal.Package--prerelease'
workingDirectory: '$(Build.SourcesDirectory)/Web'
在后一种情况下,添加了包源-但我得到了一个未经授权的错误:
info : Adding PackageReference for package 'Custom.Internal.Package' into project '/home/vsts/work/1/s/Project.Web/Web.csproj'.
info : GET https://api.nuget.org/v3/registration5-gz-semver2/custom.internal.package/index.json
info : NotFound https://api.nuget.org/v3/registration5-gz-semver2/custom.internal.package/index.json 64ms
error: Unable to load the service index for source https://myorg.pkgs.visualstudio.com/_packaging/organziational-packages/nuget/v3/index.json.
error: Response status code does not indicate success: 401 (Unauthorized).
DotNetCoreCLI
任务中的custom
命令中没有feedsToUse
,您可以将其删除,然后尝试将-v |--version
添加到软件包的版本:
info : Adding PackageReference for package 'Custom.Internal.Package' into project
'/home/vsts/work/1/s/Project.Web/Web.csproj'.
info : GET https://api.nuget.org/v3/registration5-gz-semver2/custom.internal.package/index.json
info : NotFound https://api.nuget.org/v3/registration5-gz-semver2/cbh.surescripts.business/index.json 202ms
error: There are no versions available for the package 'Custom.Internal.Package'.
- task: DotNetCoreCLI@2
displayName: 'dotnet custom'
inputs:
command: custom
projects: 'Web/*.csproj'
custom: add
arguments: 'package Custom.Internal.Package --prerelease -v 1.0.0'
我希望能够安装最新的软件包。不是特定版本如果在本地运行
dotnet add
命令,结果如何?我可以在本地执行此操作。一旦我将Azure Dev Ops工件repo添加为source-dotnet numget add source{url}-n包源。然后我可以运行dotnet添加包。。。。不指定版本-最新版本(包括预发行版)添加到.csproj。为什么我不能在管道中使用dev ops包源代码?请将变量system.debug
设置为true
,并检查是否有更多信息?您可以隐藏个人信息并共享日志。