简体   繁体   English

Azure DevOps YAML-.Net Core CLI无法使用内部工件提要打包

[英]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.

相关问题 Azure DevOps YAML-dotnet核心CLI包可生成其他项目 - Azure DevOps YAML - dotnet core CLI pack builds additional projects .net core 3.1 使用 Azure Devops 打包 dll - .net core 3.1 pack dll with Azure Devops 在用于 .Net Core 应用程序的 Azure DevOps 管道中,如何在不使用 .NetCoreCLI 任务的情况下针对 Azure 工件源进行身份验证? - In Azure DevOps pipelines for .Net Core applications, how can I authenticate against an Azure Artifacts feed without using the .NetCoreCLI task? Nuget 恢复在 Azure Devops 中无法使用工件提要 - Nuget restore not working with artifact feed in Azure Devops Can't build .NET Core 3.1 AWS Lambda function using Ubuntu hosted Pipeline in Azure DevOps - Can't build .NET Core 3.1 AWS Lambda function using Ubuntu hosted Pipeline in Azure DevOps 如何使用参数执行 Azure DevOps .NET Core CLI 任务 - How to execute Azure DevOps .NET Core CLI task with arguments Azure DevOps 管道看不到 .NET Core 3.1 SDK,但它是唯一安装的版本 - Azure DevOps pipeline can't see .NET Core 3.1 SDK, but it's the only version installed 将 Angular + .Net Core 部署到 Azure DevOps VM - Deploying Angular + .Net Core to Azure DevOps VM 由于 Nuget 工件源上的 URL 格式错误,Azure DevOps dotnet 还原任务失败 - Azure DevOps dotnet restore task fails due to wrong URL format on Nuget artifact feed 使用DevOps在Azure上部署.Net Core到Linux WebApps - Deploying .Net Core to Linux WebApps on Azure with DevOps
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM