【问题标题】:Selectively publish projects as Nuget packages to Azure Devops Artifacts有选择地将项目作为 Nuget 包发布到 Azure Devops Artifacts
【发布时间】:2022-10-05 17:42:37
【问题描述】:

我们有几个项目的解决方案。我们只希望将其中的 2 个项目发布到工件上。理想情况下,我们可以通过更改项目中的设置来管理它,因此管道可以是通用的。我们一直在寻找(试错)管道方面或项目方面的可能解决方案。他们都没有工作,或者没有项目最终成为工件或全部。有什么建议么 ?

#Build and distribute nnn.Core NuGets to nnnNugets artifacts feed
name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)

variables:
  feedName :  \'nnnNugets\'
  buildConfiguration: \'debug\'

trigger:
- nugetify

pool:
  vmImage: windows-latest

steps:
- task: DotNetCoreCLI@2
  displayName: \'Build\'
  inputs:
    command: \'build\'
    projects: \'**/*.csproj\'
    arguments: \'--configuration $(buildConfiguration)\'

- task: DotNetCoreCLI@2
  displayName: \'Pack\'
  inputs:
   command: pack
   versioningScheme: byBuildNumber

- task: NuGetAuthenticate@1
  displayName: \'NuGet Authenticate\'

- task: NuGetCommand@2
  displayName: \'NuGet push\'
  inputs:
    command: push
    publishVstsFeed: \'$(feedName)\'
    allowPackageConflicts: true

- task: PublishSymbols@2
  inputs:
    searchPattern: \'**/bin/**/*.pdb\' 
    publishSymbols: true
    symbolServerType: \'teamServices\' 
    SymbolExpirationInDays: 1000 
    IndexableFileFormats: Pdb 
    

    标签: azure-devops azure-pipelines nuget-package azure-pipelines-yaml azure-artifacts


    【解决方案1】:

    解决方案是更新 PackagesToPack 属性,以便选择与您想要的项目匹配。包括

    - task: DotNetCoreCLI@2
      displayName: 'Pack All'
      inputs:
       command: pack
       packagesToPack: '**/*.csproj; !**/Debug/**.csproj'
       versioningScheme: byBuildNumber
    

    【讨论】:

      猜你喜欢
      • 2020-01-30
      • 2019-11-08
      • 2021-05-06
      • 2023-01-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-17
      • 2019-03-26
      相关资源
      最近更新 更多