[英]Azure DevOps YAML - .Net Core CLI can't pack using internal artifact feed
I'm trying to restore, build, pack and push in Azure DevOps with .Net Core CLI using YAML. 我正在尝试使用YAML使用.Net Core CLI还原,生成,打包和推送Azure DevOps。
Restore has knowledge of the internal feed, however pack doesn't. 还原具有内部提要的知识,但是打包却不知道。
How can i add the internal feed to the pack operation? 如何将内部Feed添加到打包操作中?
parameters:
projects: ''
steps:
- task: DotNetCoreCLI@2
displayName: "ProvisionRestoreProjects"
inputs:
command: 'restore'
projects: '${{ parameters.projects }}'
feedsToUse: 'select'
vstsFeed: '/4d73414a-a21f-4f84-9355-90beadaf0a6e'
- task: DotNetCoreCLI@2
displayName: "ProvisionBuildProjects"
inputs:
command: 'build'
projects: ${{ parameters.projects }}
arguments: '--configuration release --no-cache'
- task: DotNetCoreCLI@2
displayName: "ProvisionPackProjects"
inputs:
command: 'pack'
projects: ${{ parameters.projects }}
versioningScheme: 'byEnvVar'
versionEnvVar: 'NugetVersion'
feedsToUse: 'select'
vstsFeed: '/4d73414a-a21f-4f84-9355-90beadaf0a6e'
- task: DotNetCoreCLI@2
displayName: "ProvisionPushProjects"
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
feedsToUse: 'select'
vstsFeed: '/4d73414a-a21f-4f84-9355-90beadaf0a6e'
You don't need to specify a feed in the pack
command. 您无需在pack
命令中指定供稿。
The pack
command is only to pack the files to .nupkg
file (NuGet package), then you push it to your feed. pack
命令仅将文件打包到.nupkg
文件(NuGet软件包),然后将其推送到Feed中。
More info about the command and which options can be used you can fine here . 有关该命令以及可以使用哪些选项的更多信息,请在此处进行完善 。
The pack
command " builds the project and creates NuGet packages ", that's why it is trying to restore the packages again. pack
命令“ 构建项目并创建NuGet软件包 ”,这就是为什么它试图再次还原软件包的原因。
To prevent this, add nobuild: true
to the task inputs: 为防止这种情况,请在任务输入中添加nobuild: true
:
- task: @DotNetCoreCLI@2
displayName: Pack
inputs:
command: pack
nobuild: true
It will no longer try to rebuild the project itself, but instead use the artifacts created in previous steps. 它将不再尝试重建项目本身,而是使用先前步骤中创建的工件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.